From:             bugs dot php dot net at nanonanonano dot net
Operating system: Linux
PHP version:      4CVS-2005-11-18 (CVS)
PHP Bug Type:     XML related
Bug description:  xml_parse_into_struct silently drops defined entities

Description:
------------
When called on an XML document that contains defined entities,
xml_parse_into_struct silently drops the entities from the parsed output.

(If the entity is undefined, it returns an error)

Reproduce code:
---------------
<?php
  $data = implode ("", file('entityexample.xml'));
  $parser = xml_parser_create();
  xml_parser_set_option ($parser,XML_OPTION_CASE_FOLDING,0);
  xml_parser_set_option ($parser,XML_OPTION_SKIP_WHITE,1);
  xml_parse_into_struct ($parser,$data,$values,$tags);
  xml_parser_free ($parser);
  #echo "VALS\n"; print_r($values);
  #echo "TAGS\n"; print_r($tags); 
  echo $values[2]['value']."\n";
?>
---------- entityexample.xml --------------
<?xml version='1.0'?>
<!DOCTYPE test [
  <!ENTITY times   "FOO BAR">
]>
<test>
  <item>
    <name>One &times; two</name>
  </item>
</test>


Expected result:
----------------
The entity should either be not replaced:

        One &times; two

or it should be correctly replaced:

        One FOO BAR two


Actual result:
--------------
The entity is silently dropped from the XML stream:

        One  two


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

Reply via email to