#28318 [Csd->Bgs]: Line feed characters removed

From: Date: Fri, 07 May 2004 18:38:30 +0000
Subject: #28318 [Csd->Bgs]: Line feed characters removed
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-59377@lists.php.net to get a copy of this message
ID: 28318 Updated by: amt@php.net Reported By: dev at glossword dot info -Status: Closed +Status: Bogus Bug Type: XML related Operating System: Windows XP PHP Version: 4.3.6 New Comment: Glad that works. BTW, we only "Close" actual bugs. All others are marked "Bogus." Previous Comments: ------------------------------------------------------------------------ [2004-05-07 20:06:33] dev at glossword dot info &#xA; works great. Thanks. Not a bug. ------------------------------------------------------------------------ [2004-05-07 19:45:09] amt@php.net I believe this is the correct behavior according to the XML specification. See: http://www.w3.org/TR/REC-xml/#AVNormalize To preserve line feeds, you should either wrap your attribute values inside a CDATA section or use entities, like &#xA;. ------------------------------------------------------------------------ [2004-05-07 19:29:49] dev at glossword dot info Description: ------------ Line feed characters has beed accidentally removed from a tag attributes. Reproduce code: --------------- $string = "<a title=\" 123 \n 456 \r\n 789 \">link</a>"; $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0); xml_parse_into_struct($parser, $string, $values, $tags); xml_parser_free($parser); print '<pre>'; print_r( $values ); print '</pre>'; Expected result: ---------------- I expect to keep all line feed characters in attributes. Better if it could be possible add a special option for xml_parser, like xml_parser_set_option($parser, XML_OPTION_KEEP_LF, 1); ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28318&edit=1

« previous php.bugs (#59377) next »