From:
Operating system:
PHP version: trunk-SVN-2010-05-28 (SVN)
Package: XML related
Bug Type: Feature/Change Request
Bug description:Add xml_set_entity_decl_handler function
Description:
When parsing XML, PHP has no way to set a handler for general entities,
though a
handler can be set for unparsed entities.
Expat has deprecated the XML_SetUnparsedEntityDeclHandler in favor of
XML_SetEntityDeclHandler, which is called for all entity types (including
general
and unparsed).
http://expat.cvs.sourceforge.net/viewvc/expat/expat/lib/expat.h?
revision=1.80&view=markup#l_311
PHP should add the xml_set_entity_decl_handler function to allow handling
of all
entity declarations.
Test script:
---
$data = ']>&generalEntity;';
function
h_entity_decl($parser,$entity_name,$is_parameter_entity,$value,$base,$system_id,$public_id,$notation_name)
{
echo "$entity_name - $is_parameter_entity - $value";
};
$parser = xml_parser_create();
xml_set_entity_decl_handler($parser, 'h_entity_decl');
xml_parse($parser,$data,false) or
die (sprintf("XML Error: %s at line %d\n",
xml_error_string(xml_get_error_code($parser)),
xml_get_current_line_number($parser)));
xml_parser_free($parser);
Expected result:
It should run with the following output:
generalEntity - 0 - General Entity
Actual result:
--
Fatal Error: Call to undefined function xml_set_entity_decl_handler()
--
Edit bug report at http://bugs.php.net/bug.php?id=51939&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=51939&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=51939&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=51939&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=51939&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=51939&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=51939&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=51939&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=51939&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=51939&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=51939&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=51939&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=51939&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=51939&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=51939&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51939&r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=51939&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=51939&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=51939&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=51939&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=51939&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=51939&r=mysqlcfg