#18033 [Opn->Ver]: Leading white space is lost inside processing-instruction data
| From: | iliaa@php.net | Date: | Wed, 16 Oct 2002 20:25:42 +0000 |
| Subject: | #18033 [Opn->Ver]: Leading white space is lost inside processing-instruction data | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-22607@lists.php.net to get a copy of this message | ||
ID: 18033
Updated by: iliaa@php.net
Reported By: gk@proliberty.com
-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] gk@proliberty.com
<?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