ID: 27430 Updated by: [EMAIL PROTECTED] Reported By: zyxwvu at users dot sourceforge dot net -Status: Open +Status: Bogus Bug Type: *XML functions Operating System: Windows XP Pro PHP Version: 5CVS-2004-02-28 (dev) New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Those were removed in later releases. Previous Comments: ------------------------------------------------------------------------ [2004-02-28 14:45:55] zyxwvu at users dot sourceforge dot net Description: ------------ I've got this PHP code: $xml = simplexml_load_file('file.xml'); foreach($xml-> children() as $name => $item){ echo $name.'<br/>'; } It was working with older PHP 5 snapshots (as I know, from January). But: I have installed the newest PHP snapshot, and it returns: Fatal error: Call to undefined method simplexml_element::children() in myfile.php on line xxx The same problem is with "xpath()" method. Reproduce code: --------------- <?php $xml = simplexml_load_string( '<person> <child role="son"> <child role="daughter"/> </child> <child role="daughter"> <child role="son"> <child role="son"/> </child> </child> </person>'); foreach ($xml->children() as $second_gen) { echo ' The person begot a ' . $second_gen['role']; foreach ($second_gen->children() as $third_gen) { echo ' who begot a ' . $third_gen['role'] . ';'; foreach ($third_gen->children() as $fourth_gen) { echo ' and that ' . $third_gen['role'] . ' begot a ' . $fourth_gen['role']; } } } ?> Expected result: ---------------- The person begot a son who begot a daughter; The person begot a daughter who begot a son; and that son begot a son Actual result: -------------- Fatal error: Call to undefined method simplexml_element::children() in file etc. etc. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27430&edit=1