#34644 [NEW]: Unbound prefix error when using xml_parser_create_ns
| From: | markkevans at gmail dot com | Date: | Mon, 26 Sep 2005 12:37:33 +0000 |
| Subject: | #34644 [NEW]: Unbound prefix error when using xml_parser_create_ns | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-85591@lists.php.net to get a copy of this message | ||
From: markkevans at gmail dot com
Operating system: FreeBSD 5.4
PHP version: 4.4.0
PHP Bug Type: XML related
Bug description: Unbound prefix error when using xml_parser_create_ns
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 bug report at http://bugs.php.net/?id=34644&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34644&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34644&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34644&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34644&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34644&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34644&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34644&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34644&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34644&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34644&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=34644&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=34644&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34644&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34644&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34644&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34644&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34644&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34644&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34644&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34644&r=mysqlcfg