#18033 [Ver->Bgs]: Leading white space is lost inside processing-instruction data

From: Date: Sat, 09 Aug 2003 20:04:45 +0000
Subject: #18033 [Ver->Bgs]: Leading white space is lost inside processing-instruction data
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-45637@lists.php.net to get a copy of this message
ID: 18033 Updated by: rrichards@php.net Reported By: gk at proliberty dot com -Status: Verified +Status: Bogus Bug Type: XML related Operating System: linux 2.4.18 PHP Version: 4.3.3RC2-dev 5.0.0b2 New Comment: Whitespace after the target are removed - normal behavior. The linespacing (between the closing bug tag and the PI) is screwed up as your xml is not well formed. As far as whitespaces in the variable producing blank output, check the return error. The xml declaration is probably screwed up to produce no output. This was the only instance I could reproduce no output. Previous Comments: ------------------------------------------------------------------------ [2002-10-16 15:25:42] iliaa@php.net 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. ------------------------------------------------------------------------ [2002-06-27 20:54:15] gk at proliberty dot 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

« previous php.bugs (#45637) next »