ID: 18033
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Open
+Status: Verified
Bug Type: XML related
Operating System: linux 2.4.18
-PHP Version: 4.2.1
+PHP Version: 4.3.0-dev
New Comment:
There is another issue here that I've come across while testing the
bug. If the variable containing the XML data contains any white space
such as \n, \r or ' ', the resulting output is blank.
Previous Comments:
------------------------------------------------------------------------
[2002-06-27 20:54:15] [EMAIL PROTECTED]
<?php
/*
BUG in PHP 4.2.1:
Leading white space is lost inside processing-instruction data, prior
to first character after pi-target
output is:
bug
php 4.2.1
bugpi_data=hello
end_pi_data
output SHOULD be:
bug
php 4.2.1
bug
pi_data=
hello
end_pi_data
*/
/// CODE TO REPRODUCE BUG
$q = '?';
$xmlSource = <<< EOD
<{$q}xml version="1.0"{$q}>
<bug>
php 4.2.1
</bug>
<{$q}php
hello
{$q}>
EOD;
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
// this doesn't do anything:
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
xml_set_element_handler($parser, "start_element", "stop_element");
xml_set_character_data_handler($parser, "char_data");
xml_set_processing_instruction_handler( $parser, "_handlePI");
xml_parse( $parser, $xmlSource );
function _handlePI($parser, $target, $data) {
echo("pi_data=".$data."end_pi_data"); exit;
}
function start_element($parser, $data, $attribs) {
echo $data;
}
function stop_element($parser, $data ) {
echo $data;
}
function char_data($parser, $data ) {
echo $data;
}
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18033&edit=1