Bug #18033: Leading white space is lost inside processing-instruction data
| From: | gk at proliberty dot com | Date: | Fri, 28 Jun 2002 00:54:15 +0000 |
| Subject: | Bug #18033: Leading white space is lost inside processing-instruction data | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-12288@lists.php.net to get a copy of this message | ||
From: gk@proliberty.com
Operating system: linux 2.4.18
PHP version: 4.2.1
PHP Bug Type: XML related
Bug description: Leading white space is lost inside processing-instruction data
<?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 bug report at http://bugs.php.net/?id=18033&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=18033&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18033&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18033&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18033&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18033&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18033&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18033&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18033&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18033&r=globals