From: cpriest at warpmail dot net Operating system: Windows PHP version: 5.2.4RC2 PHP Bug Type: SimpleXML related Bug description: xmlns parsing issues
Description: ------------ SimpleXML is having some difficulty in parsing XML which contains a default xmlns entry. Reproduce code: --------------- <? header('Content-Type: text/plain'); $ResponseBody = '<?xml version="1.0" encoding="UTF-8"?> <result xmlns="https://zzz.com/webservices" xmlns:xsd="https://www.w3.org/2001/XMLSchema" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">Test</result>'; $objXML = new SimpleXMLElement($ResponseBody); $tMatches = $objXML->xpath('/result'); print_r((string)$tMatches[0]); ?> Expected result: ---------------- Expect print_r() to print "Test" Actual result: -------------- $tMatches is an empty array() If you change the xmlns="https://zzz.com/webservices" to xmlns:zzz="https://zzz.com/webservices" (add a namespace sub-string), it works fine. -- Edit bug report at http://bugs.php.net/?id=42325&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42325&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42325&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42325&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42325&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42325&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42325&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42325&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42325&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42325&r=support Expected behavior: http://bugs.php.net/fix.php?id=42325&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42325&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42325&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42325&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42325&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42325&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42325&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42325&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42325&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42325&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42325&r=mysqlcfg