|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-04-05 08:08 UTC] sniper@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 11:00:01 2025 UTC |
Description: ------------ When using a xml_parser, initialized with the function above, any newlines inside a cdata block (even when the node is enclosed in <![CDATA[]>) are ignored. The same function was tested with PHP 5, and it worked. Reproduce code: --------------- class Article_Parser { function Article_Parser($fname) { $this->xp = xml_parser_create(); xml_parser_set_option($this->xp, XML_OPTION_TARGET_ENCODING, "ISO-8859-1"); xml_set_element_handler($this->xp, 'openTag', 'closeTag'); xml_parser_set_option($this->xp,XML_OPTION_SKIP_WHITE, 0); xml_set_character_data_handler($this->xp, 'cdataHandler'); xml_set_object($this->xp, $this); $this->tree = array(); $this->__stack = array(); $this->__sptr = -1; xml_parse($this->xp, file_get_contents($fname)) or die('Erro ao fazer parsing do arquivo!'); xml_parser_free($this->xp); } Expected result: ---------------- A parsed XML file with its newlines. Actual result: -------------- A parsed XML file, whose newlines were ignored.