Bug #62577 [Opn]: simplexml_load_file does not file if libxml_disable_entity_loader(true)
| From: | pajoye@php.net | Date: | Thu, 15 Nov 2012 11:03:10 +0000 |
| Subject: | Bug #62577 [Opn]: simplexml_load_file does not file if libxml_disable_entity_loader(true) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-174707@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62577&edit=1
ID: 62577
Updated by: pajoye@php.net
Reported by: ivan dot enderlin at hoa-project dot net
Summary: simplexml_load_file does not file if
libxml_disable_entity_loader(true)
Status: Open
Type: Bug
Package: SimpleXML related
Operating System: All
PHP Version: master-Git-2012-07-16 (Git)
-Assigned To:
+Assigned To: rrichards
Block user comment: N
Private report: N
New Comment:
hi Rob!
What would be the best/cleanest fix for this issue? It affects quite a lot of apps
out there.
Thanks!
Previous Comments:
------------------------------------------------------------------------
[2012-07-16 09:25:29] ivan dot enderlin at hoa-project dot net
I think it's not a normal behavior.
------------------------------------------------------------------------
[2012-07-16 09:22:31] jpauli@php.net
http://lxr.php.net/xref/PHP_5_4/ext/libxml/libxml.c#1058
libxml_disable_entity_loader(true) registers a NULL function
(http://lxr.php.net/xref/PHP_5_4/ext/libxml/libxml.c#372) as callback for URI
input file handling in libxml.
So you cant open any file with libxml after having called this function.
Is that the correct behavior ? I have no clue to answer that
------------------------------------------------------------------------
[2012-07-16 08:56:06] ivan dot enderlin at hoa-project dot net
Description:
------------
The function simplexml_load_file() failed to open any file (existing or not) if
libxml_disable_entity_loader(true) has been called.
I have tried with simplexml_load_string(), it works; same with new SimpleXMLElement() etc. The bug
is restricted to the simplexml_load_file() function.
Test script:
---------------
<?php
libxml_use_internal_errors(true);
libxml_disable_entity_loader(true);
$xml = simplexml_load_file('foo');
print_r(libxml_get_errors());
var_dump($xml);
Expected result:
----------------
Array
(
)
â¦
Actual result:
--------------
Array
(
[0] => LibXMLError Object
(
[level] => 1
[code] => 1549
[column] => 0
[message] => failed to load external entity "foo"
[file] =>
[line] => 0
)
)
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62577&edit=1