[PHP-BUG] Bug #65172 [NEW]: SimpleXMLElement::children() incorrect behavior
From: scruoge at gmail dot com Operating system: Windows PHP version: 5.3.26 Package: SimpleXML related Bug Type: Bug Bug description:SimpleXMLElement::children() incorrect behavior Description: XPath, selecting attribute returns SimpleXMLElement, which's children() method returns NULL. Probably it's a documentation issue. It says "Returns a SimpleXMLElement element, whether the node has children or not." Test script: --- nodeContents'; $xml = new SimpleXMLElement($s); $xpathres = $xml->xpath('childNode/@attr'); $xres = array_shift($xpathres); $xres = array_shift($xml->xpath('childNode/@attr')); echo '$xres->children() result: '; var_dump($xres->children()); echo 'typecast result: '; var_dump((string) $xres); Expected result: $xres->children() result: object(SimpleXMLElement)#2 (0) { } typecast result: string(7) "attrval" Actual result: -- $xres->children() result: NULL typecast result: string(7) "attrval" -- Edit bug report at https://bugs.php.net/bug.php?id=65172&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65172&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=65172&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65172&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=65172&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=65172&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=65172&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=65172&r=needscript Try newer version: https://bugs.php.net/fix.php?id=65172&r=oldversion Not developer issue:https://bugs.php.net/fix.php?id=65172&r=support Expected behavior: https://bugs.php.net/fix.php?id=65172&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=65172&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=65172&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=65172&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65172&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=65172&r=dst IIS Stability: https://bugs.php.net/fix.php?id=65172&r=isapi Install GNU Sed:https://bugs.php.net/fix.php?id=65172&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=65172&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=65172&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=65172&r=mysqlcfg
Bug #65172 [Opn]: SimpleXMLElement::children() incorrect behavior
Edit report at https://bugs.php.net/bug.php?id=65172&edit=1 ID: 65172 User updated by:scruoge at gmail dot com Reported by:scruoge at gmail dot com Summary:SimpleXMLElement::children() incorrect behavior Status: Open Type: Bug Package:SimpleXML related Operating System: Windows PHP Version:5.3.26 Block user comment: N Private report: N New Comment: There's extra string in the code that should be removed: (line 6) $xres = array_shift($xml->xpath('childNode/@attr')); It does not affect test script result, though it generates E_STRICT notice. Previous Comments: [2013-07-01 07:54:26] scruoge at gmail dot com Description: XPath, selecting attribute returns SimpleXMLElement, which's children() method returns NULL. Probably it's a documentation issue. It says "Returns a SimpleXMLElement element, whether the node has children or not." Test script: --- nodeContents'; $xml = new SimpleXMLElement($s); $xpathres = $xml->xpath('childNode/@attr'); $xres = array_shift($xpathres); $xres = array_shift($xml->xpath('childNode/@attr')); echo '$xres->children() result: '; var_dump($xres->children()); echo 'typecast result: '; var_dump((string) $xres); Expected result: $xres->children() result: object(SimpleXMLElement)#2 (0) { } typecast result: string(7) "attrval" Actual result: -- $xres->children() result: NULL typecast result: string(7) "attrval" -- Edit this bug report at https://bugs.php.net/bug.php?id=65172&edit=1
Bug #65172 [Opn]: SimpleXMLElement::children() incorrect behavior
Edit report at https://bugs.php.net/bug.php?id=65172&edit=1 ID: 65172 User updated by:scruoge at gmail dot com Reported by:scruoge at gmail dot com Summary:SimpleXMLElement::children() incorrect behavior Status: Open Type: Bug Package:SimpleXML related -Operating System: Windows +Operating System: Windows & Linux PHP Version:5.3.26 Block user comment: N Private report: N New Comment: The bug is also reproducible in Linux environment. Previous Comments: [2013-07-01 07:58:40] scruoge at gmail dot com There's extra string in the code that should be removed: (line 6) $xres = array_shift($xml->xpath('childNode/@attr')); It does not affect test script result, though it generates E_STRICT notice. ---- [2013-07-01 07:54:26] scruoge at gmail dot com Description: XPath, selecting attribute returns SimpleXMLElement, which's children() method returns NULL. Probably it's a documentation issue. It says "Returns a SimpleXMLElement element, whether the node has children or not." Test script: --- nodeContents'; $xml = new SimpleXMLElement($s); $xpathres = $xml->xpath('childNode/@attr'); $xres = array_shift($xpathres); $xres = array_shift($xml->xpath('childNode/@attr')); echo '$xres->children() result: '; var_dump($xres->children()); echo 'typecast result: '; var_dump((string) $xres); Expected result: $xres->children() result: object(SimpleXMLElement)#2 (0) { } typecast result: string(7) "attrval" Actual result: -- $xres->children() result: NULL typecast result: string(7) "attrval" -- Edit this bug report at https://bugs.php.net/bug.php?id=65172&edit=1
Bug #65172 [Opn]: SimpleXMLElement::children() incorrect behavior
Edit report at https://bugs.php.net/bug.php?id=65172&edit=1 ID: 65172 User updated by:scruoge at gmail dot com Reported by:scruoge at gmail dot com Summary:SimpleXMLElement::children() incorrect behavior Status: Open Type: Bug Package:SimpleXML related Operating System: Windows & Linux PHP Version:5.3.26 Block user comment: N Private report: N New Comment: Yes, I agree. As I suspected it's a documentation problem. Previous Comments: [2013-07-19 19:07:15] mail+php at requinix dot net ...Attributes can't have children. If you mean the difference between returning an empty SimpleXMLElement object versus returning null, I can see that as a doc bug: Return Values for children() should say "Returns NULL if called on a SimpleXMLElement object that represents an attribute and not a tag." as it does for attributes(). ---- [2013-07-01 09:27:51] scruoge at gmail dot com The bug is also reproducible in Linux environment. ---- [2013-07-01 07:58:40] scruoge at gmail dot com There's extra string in the code that should be removed: (line 6) $xres = array_shift($xml->xpath('childNode/@attr')); It does not affect test script result, though it generates E_STRICT notice. ---------------- [2013-07-01 07:54:26] scruoge at gmail dot com Description: XPath, selecting attribute returns SimpleXMLElement, which's children() method returns NULL. Probably it's a documentation issue. It says "Returns a SimpleXMLElement element, whether the node has children or not." Test script: --- nodeContents'; $xml = new SimpleXMLElement($s); $xpathres = $xml->xpath('childNode/@attr'); $xres = array_shift($xpathres); $xres = array_shift($xml->xpath('childNode/@attr')); echo '$xres->children() result: '; var_dump($xres->children()); echo 'typecast result: '; var_dump((string) $xres); Expected result: $xres->children() result: object(SimpleXMLElement)#2 (0) { } typecast result: string(7) "attrval" Actual result: -- $xres->children() result: NULL typecast result: string(7) "attrval" -- Edit this bug report at https://bugs.php.net/bug.php?id=65172&edit=1
#45922 [Com]: data is not transmitted throught pipes created by proc_open
ID: 45922 Comment by: scruoge at gmail dot com Reported By: TorokAlpar at Gmail dot com Status: Open Bug Type: Streams related Operating System: Windows Xp PHP Version: 5.2CVS-2008-08-27 New Comment: PHP Version 5.2.6, Apache/2.0.63 Handler Linux hostname 2.6.18-53.el5 #1 SMP Mon Nov 12 02:22:48 EST 2007 i686 I have exactly same bug. Script just silently dies. here is the code: array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("file", "/home/user/error-output.txt", "a") ); $process = proc_open('/usr/local/bin/client', $desc, $pipes); if (is_resource($process)) { fwrite($pipes[0], $line); fclose($pipes[0]); $line = ''; while (($s = fgets($pipes[1], 1000)) !== false) { $s = trim($s, "\r\n"); $line.= $s; if(strpos($s, '') !== false) break; } fclose($pipes[1]); $return_value = proc_close($process); } $line = trim($line, "\r\n"); return $line; } echo test1('asdfasdf')."\n"; ?> Previous Comments: [2008-08-27 08:56:20] TorokAlpar at Gmail dot com I have tried with the latest snapshot, the result is the same [2008-08-26 14:31:43] TorokAlpar at Gmail dot com Description: After starting a program (Written in C) with proc_open the pipes opened seem to be invalid. It looks like no data is transmitted over to the childs stdin, On a read the script blocks. Please bear with me, this is my firs bug report, and i am debugging this for 7 hours now. here are my modules: [PHP Modules] bcmath calendar com_dotnet ctype date dom domxml exif filter ftp gd gettext hash iconv imap json libxml mbstring mcrypt mime_magic ming mssql mysql mysqli odbc paradox pcre pdf PDO pdo_mssql pdo_mysql ps Reflection session SimpleXML soap sockets SPL SQLite standard tokenizer wddx xdebug xml xmlreader xmlrpc xmlwriter xsl zip zlib [Zend Modules] Xdebug Note tha i also tried without Xdebug Reproduce code: --- $aDescriptorspec = array( 0 => array("pipe", "r"), // stdin is a pipe that the child will read from 1 => array("pipe", "w"), // stdout is a pipe that the child will write to 2 => array("pipe", "w") // stderr is a file to write to ); $aOptions = array('bypass_shell' => true); // doesn't influence the behavior $rProcess = proc_open('F:\\checkpe-debug2.exe validpe', $aDescriptorspec, $aPipes, null,null, $aOptions); // $aPipes now looks like this: // 0 => writeable handle connected to child stdin // 1 => readable handle connected to child stdout if (! is_resource($rProcess)) { // stream_set_write_buffer($aPipes[0], 0); //fputs($aPipes[0],$sPath."\n",strlen($sPath)+1); fwrite($aPipes[0],$sPath."\n"); //fflush($aPipes[0]); sleep(1); $sResponse = fread($aPipes[1],2); var_dump($sResponse); } /* NOTE : Commented lines don't influence the result if they are not commented The executable does work right, tested on the command line If you swap the executable with a php script that does the same thing (reads in file paths separated with \n and writes 2 character responses) everything functions as expected */ Expected result: var_dump the 2 characters read from the output of the child Actual result: -- Script hangs , hang caused by the lien that reads: $sResponse = fread($aPipes[1],2); -- Edit this bug report at http://bugs.php.net/?id=45922&edit=1