From:             joern_h at gmx dot net
Operating system: Windows 2000
PHP version:      5CVS-2005-03-24 (dev)
PHP Bug Type:     *XML functions
Bug description:  Tags and entity references in entities are not parsed

Description:
------------
When the replacement for an entity contains xml tags or another entity
these do not get parsed by PHP5. Such constructs are used for example
inside the PHP documentation to mark up often used strings like warnings
and section titles. This code works in PHP4.

Reproduce code:
---------------
<?php

error_reporting(E_ALL);

$xml = <<<HERE
<!DOCTYPE test [
    <!ENTITY test "<abc>&amp;</abc>">
]>
<test>&test;</test>
HERE;

function startHandler($parser, $name, $attrs) {print("StartHandler
Called\n");}
function endHandler($parser, $name) {print("EndHandler Called\n");}
function characterHandler($parser, $data) {echo "Character: $data\n";}

$parser =& xml_parser_create('');
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);

xml_set_element_handler($parser, 'startHandler', 'endHandler');
xml_set_character_data_handler($parser, 'characterHandler');

if (!xml_parse($parser, $xml, true))
    echo xml_error_string($parser);

xml_parser_free($parser);

?>


Expected result:
----------------
StartHandler Called
StartHandler Called
Character: &
EndHandler Called
EndHandler Called

Actual result:
--------------
StartHandler Called
Character: <abc>&amp;</abc>
EndHandler Called

-- 
Edit bug report at http://bugs.php.net/?id=32441&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=32441&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=32441&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=32441&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=32441&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=32441&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=32441&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=32441&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=32441&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=32441&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=32441&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=32441&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=32441&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=32441&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=32441&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=32441&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=32441&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=32441&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=32441&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=32441&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=32441&r=mysqlcfg

Reply via email to