Bug #71592 [NEW]: External entity processing never fail regardless of handler return code
| From: | anrdaemon at freemail dot ru | Date: | Mon, 15 Feb 2016 01:39:55 +0000 |
| Subject: | Bug #71592 [NEW]: External entity processing never fail regardless of handler return code | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-199211@lists.php.net to get a copy of this message | ||
From: anrdaemon at freemail dot ru
Operating system: Windows
PHP version: 5.6.18
Package: XML related
Bug Type: Bug
Bug description:External entity processing never fail regardless of handler return code
Description:
------------
Despite documentation[1] explicitly stating that "If the value returned
from the handler is FALSE (which it will be if no value is returned),
the XML parser will stop parsing and xml_get_error_code() will return
XML_ERROR_EXTERNAL_ENTITY_HANDLING.", the output of the attached test
script will always be "No error".
phpinfo()
PHP Version => 5.6.18
xml
XML Support => active
XML Namespace Support => active
libxml2 Version => 2.9.3
[1]http://php.net/xml_set_external_entity_ref_handler
Test script:
---------------
<?php
$parser = xml_parser_create_ns('UTF-8');
xml_set_external_entity_ref_handler($parser, function($self, $names,
$base, $system_id, $public_id)
{
print "@{$names}: '{$system_id}' {$public_id}\n";
/* Ref: http://php.net/xml_set_external_entity_ref_handler
If the value returned from the handler is FALSE (which it will be
if no
value is returned), the XML parser will stop parsing and
xml_get_error_code() will return
XML_ERROR_EXTERNAL_ENTITY_HANDLING.
*/
return false;
}
);
xml_parse($parser, '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE p [
<!ENTITY pic PUBLIC "image.gif" "http://example.org/image.gif">
]>
<p>&pic;</p>');
print xml_error_string(xml_get_error_code($parser)) . "\n";
?>
--
Edit bug report at https://bugs.php.net/bug.php?id=71592&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71592&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71592&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71592&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71592&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71592&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71592&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71592&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71592&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71592&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71592&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71592&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71592&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71592&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71592&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71592&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71592&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71592&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71592&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71592&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71592&r=mysqlcfg