#31409 [NEW]: Element is in wrong Namespace
| From: | joern_h at gmx dot net | Date: | Tue, 04 Jan 2005 18:01:33 +0000 |
| Subject: | #31409 [NEW]: Element is in wrong Namespace | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-71456@lists.php.net to get a copy of this message | ||
From: joern_h at gmx dot net
Operating system: Windows 2000
PHP version: 5.0.3
PHP Bug Type: XML related
Bug description: Element is in wrong Namespace
Description:
------------
When an empty element is has a xmlns attribute the element following it is
also reported to be in this namespace. In the following example the 'a'
element is wrongly reported as being in the 'http://t/'
namespace.
Reproduce code:
---------------
<?php
$xml = <<<HERE
<?xml version="1.0" encoding="utf-8" ?>
<root>
<test xmlns="http://t/" />
<a />
</root>
HERE;
$parser =& xml_parser_create_ns('utf-8', ';');
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, true);
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
$index = array();
$vals = array();
if (!xml_parse_into_struct($parser, $xml, $vals, $index)) {
echo xml_error_string(xml_get_error_code($parser)) . "\n";
}
print_r($vals);
xml_parser_free($parser);
?>
Expected result:
----------------
Array
(
[0] => Array
(
[tag] => root
[type] => open
[level] => 1
)
[1] => Array
(
[tag] => http://t/;test
[type] => complete
[level] => 2
)
[2] => Array
(
[tag] => a
[type] => complete
[level] => 2
)
[3] => Array
(
[tag] => root
[type] => close
[level] => 1
)
)
Actual result:
--------------
Array
(
[0] => Array
(
[tag] => root
[type] => open
[level] => 1
)
[1] => Array
(
[tag] => http://t/;test
[type] => complete
[level] => 2
)
[2] => Array
(
[tag] => http://t/;a
[type] => complete
[level] => 2
)
[3] => Array
(
[tag] => root
[type] => close
[level] => 1
)
)
--
Edit bug report at http://bugs.php.net/?id=31409&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31409&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31409&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31409&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31409&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31409&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31409&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31409&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31409&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31409&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31409&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31409&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31409&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31409&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31409&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31409&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31409&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31409&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31409&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31409&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31409&r=mysqlcfg