#34644 [Opn->Bgs]: Unbound prefix error when using xml_parser_create_ns
| From: | chregu@php.net | Date: | Mon, 26 Sep 2005 13:56:00 +0000 |
| Subject: | #34644 [Opn->Bgs]: Unbound prefix error when using xml_parser_create_ns | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-85594@lists.php.net to get a copy of this message | ||
ID: 34644
Updated by: chregu@php.net
Reported By: markkevans at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: XML related
Operating System: FreeBSD 5.4
PHP Version: 4.4.0
New Comment:
You have to declare the namespace, your xml is not valid this
way...
Previous Comments:
------------------------------------------------------------------------
[2005-09-26 14:37:31] markkevans at gmail dot com
Description:
------------
When attempting to create an XML parser using xml_parser_create_ns and
parsing the structure using xml_parse_into_struct an error is thrown.
My configure settings
'./configure' '--enable-versioning' '--enable-memory-limit'
'--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/etc/php'
'--disable-all' '--with-regex=php' '--with-apxs2=/usr/local/sbin/apxs'
'--prefix=/usr/local' 'i386-portbld-freebsd5.4'
XML Support active
XML Namespace Support active
EXPAT Version expat_1.95.8
When running the same code on Windows XP the expected result is
returned sucessfully.
Reproduce code:
---------------
<?php
$sData = "<my:object
name='__root'>%3Chtml%3E%0A%3Chead%3E%0A%3Ctitle%3E<my:variable
name='Test'/>%3C%2Ftitle%3E%0A%0A%3C%2Fhead%3E%0A%3Cbody%3E%0A%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E%0A</my:object>";
$xml_parser = xml_parser_create_ns();
if (!xml_parse_into_struct($xml_parser, $sData, $aVals, $aIndex))
{
$nErrorCode = xml_get_error_code($xml_parser);
$sError = xml_error_string($nErrorCode);
$sErrorMessage = 'XML Parser Error: Error Code: ' . $nErrorCode . '
Error String: ' . $sError . ' Line Number: ' .
xml_get_current_line_number($xml_parser);
trigger_error($sErrorMessage, E_USER_WARNING);
}
echo "<PRE>";
print_r($aVals);
echo "</PRE>";
?>
Expected result:
----------------
Array
(
[0] => Array
(
[tag] => MY:OBJECT
[type] => open
[level] => 1
[attributes] => Array
(
[NAME] => __root
)
[value] => %3Chtml%3E%0A%3Chead%3E%0A%3Ctitle%3E
)
[1] => Array
(
[tag] => MY:VARIABLE
[type] => complete
[level] => 2
[attributes] => Array
(
[NAME] => Test
)
)
[2] => Array
(
[tag] => MY:OBJECT
[value] =>
%3C%2Ftitle%3E%0A%0A%3C%2Fhead%3E%0A%3Cbody%3E%0A%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E%0A
[type] => cdata
[level] => 1
)
[3] => Array
(
[tag] => MY:OBJECT
[type] => close
[level] => 1
)
)
Actual result:
--------------
Warning: XML Parser Error: Error Code: 27 Error String: unbound prefix
Line Number: 1 in /usr/local/www/data-dist/xml/test.php on line 11
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34644&edit=1