|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-09-26 15:55 UTC] chregu@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 00:00:01 2025 UTC |
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