#32581 [NEW]: Parser ignores newlines
| From: | acoster at gmail dot com | Date: | Tue, 05 Apr 2005 01:47:54 +0000 |
| Subject: | #32581 [NEW]: Parser ignores newlines | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-76343@lists.php.net to get a copy of this message | ||
From: acoster at gmail dot com
Operating system: Linux 2.4.26-grsec
PHP version: 4.3.10
PHP Bug Type: *XML functions
Bug description: Parser ignores newlines
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.
--
Edit bug report at http://bugs.php.net/?id=32581&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32581&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32581&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32581&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32581&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32581&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32581&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32581&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32581&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32581&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32581&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32581&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32581&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32581&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32581&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32581&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32581&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32581&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32581&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32581&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32581&r=mysqlcfg