Edit report at https://bugs.php.net/bug.php?id=62577&edit=1

 ID:                 62577
 Updated by:         jpa...@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)
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[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

Reply via email to