#30566 [NEW]: Parsing a document with namespaces gives different result as PHP4
| From: | joern_h at gmx dot net | Date: | Tue, 26 Oct 2004 15:52:55 +0000 |
| Subject: | #30566 [NEW]: Parsing a document with namespaces gives different result as PHP4 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-68102@lists.php.net to get a copy of this message | ||
From: joern_h at gmx dot net
Operating system: Win 2000
PHP version: 5.0.2
PHP Bug Type: XML related
Bug description: Parsing a document with namespaces gives different result as PHP4
Description:
------------
When parsing a document with multiple / default namespaces a wrong
namespace can be reported. PHP 4.3.8 shows the right result.
Reproduce code:
---------------
<?php
error_reporting(E_ALL);
$xml = <<<HEREDOC
<?xml version="1.0"?>
<x xmlns="http://x/" xmlns:y="http://y/">
<y z="z" y:y="y" xmlns="http://a/" />
</x>
HEREDOC;
$p =& xml_parser_create_ns(null, "\n");
$vals = array();
$index = array();
xml_parser_set_option($p, XML_OPTION_SKIP_WHITE, true);
xml_parser_set_option($p, XML_OPTION_CASE_FOLDING, false);
if (!xml_parse_into_struct($p, $xml , $vals, $index)) {
echo xml_error_string($p);
}
xml_parser_free($p);
print_r($vals);
?>
Expected result:
----------------
The attribute y:y should be in the http://y/ namespace, this is also the
result when using PHP 4.3.8
Actual result:
--------------
With PHP 5.02 the attribute y:y is in the http://a/ namespace. When the z
attribute is removed the bug does not occur.
--
Edit bug report at http://bugs.php.net/?id=30566&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30566&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30566&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30566&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30566&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30566&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30566&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30566&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30566&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30566&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30566&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30566&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30566&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30566&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30566&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30566&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30566&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30566&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30566&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30566&r=mysqlcfg