Edit report at https://bugs.php.net/bug.php?id=55353&edit=1
ID: 55353
User updated by: pim at highattention dot nl
Reported by: pim at highattention dot nl
Summary: XML Error in 5.3.6
-Status: Feedback
+Status: Open
Type: Bug
Package: *XML functions
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
<?php
function parse( $xml ){
//$this->_parserMemory = array();
$parser = xml_parser_create('UTF-8');
xml_set_object($parser, $this);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-
8');
xml_set_element_handler($parser, "_xmlTagOpen", "_xmlTagClose");
xml_set_character_data_handler($parser, "_xmlCdata");
if (!xml_parse($parser, $xml)) {
$this->_children = array();
$error_code = xml_get_error_code($parser);
$error_string = xml_error_string($error_code);
$current_line = xml_get_current_line_number($parser);
$current_column =
xml_get_current_column_number($parser);
echo ("Parser error #{$error_code}: {$error_string} on
line {$current_line}, column {$current_column}.");
}
//unset($this->_parserMemory);
xml_parser_free($parser);
}
$xml = '<simplexml>
<name>PageControl</name>
<title>Paginabeheer</title>
<version>1.0.0</version>
<cms_routes>
<index type="default"
inMenu="true" authlevel="50">
<title>Overzicht</title>
<parts>
<part>pagecontrol</part>
<part>*</part>
</title>
</index>
</cms>
</version>
</simplexml>';
parse( $xml );
?>
Previous Comments:
------------------------------------------------------------------------
[2011-08-03 10:36:51] [email protected]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2011-08-03 10:34:14] pim at highattention dot nl
Description:
------------
---
>From manual page: http://www.php.net/function.xml-parse%23Description
---
We migrate from 5.2 to 5.3 and gives a error:
Parser error #73: > required on line 6, column 14.
Test script:
---------------
PHP
-----------------------------------------
$this->_parserMemory = array();
$parser = xml_parser_create('UTF-8');
xml_set_object($parser, $this);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING,
'UTF-8');
xml_set_element_handler($parser, "_xmlTagOpen", "_xmlTagClose");
xml_set_character_data_handler($parser, "_xmlCdata");
if (!xml_parse($parser, $xml)) {
$this->_children = array();
$error_code = xml_get_error_code($parser);
$error_string = xml_error_string($error_code);
$current_line = xml_get_current_line_number($parser);
$current_column =
xml_get_current_column_number($parser);
throw new Idify_FileHandler_Xml_Exception("In
{$this->_filename} : Parser error #{$error_code}: {$error_string} on line
{$current_line}, column {$current_column}.");
}
unset($this->_parserMemory);
xml_parser_free($parser);
----------------------------------------
XML
----------------------------------------
<simplexml>
<name>PageControl</name>
<title>Paginabeheer</title>
<version>1.0.0</version>
<cms_routes>
<index type="default" inMenu="true" authlevel="50">
<title>Overzicht</title>
<parts>
<part>pagecontrol</part>
<part>*</part>
Expected result:
----------------
No error, system gives a new error on a attribute. Exact xml in 5.2 and 5.3,
but
in 5.3, he gives a error on a attribute.
And gives a error on: <?xml version="1.0"?>, when I remove this line the error
disapear
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55353&edit=1