#49437 [NEW]: Can't disable LIBXML_NOENT option
| From: | matt at matthewfagan dot com | Date: | Wed, 02 Sep 2009 05:30:08 +0000 |
| Subject: | #49437 [NEW]: Can't disable LIBXML_NOENT option | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-141834@lists.php.net to get a copy of this message | ||
From: matt at matthewfagan dot com
Operating system: ALL
PHP version: 5.2.10
PHP Bug Type: SimpleXML related
Bug description: Can't disable LIBXML_NOENT option
Description:
------------
One of the options to simplexml_load_string is LIBXML_NOENT. This option
cannot be turned off.
Reproduce code:
---------------
The prototype for the simplexml_load_string function is:
object simplexml_load_string ( string $data [, string
$class_name="SimpleXMLElement" [, int $options=0 [, string $ns [, bool
$is_prefix=false ]]]] )
Note the "$options=0". However, it actually behaves like
"$options=LIBXML_NOENT". There is no way to disable this behavior.
Explicitly specifying 0 does not turn off LIBXML_NOENT.
Code to reproduce:
echo simplexml_load_string("<data>&</data>",
"SimpleXMLElement", 0);
Expected result:
----------------
This should return "&", because I have explicity turned off the
LIBXML_NOENT option. However, "&" is converted to "&" by libxml
regardless of the specified options.
It's as if the underlying C code is calling:
libxml->load_string(data, classname, options | LIBXML_NOENT);
(Note: not the real function names...)
Actual result:
--------------
Resolution:
There would seem to be two resolutions. Either:
a) Change the prototype so that the default value of $options is
LIBXML_NOENT, allowing this to be overridden by specifying the options.
OR
b) Create a special LIBXML flag especially for PHP, such as LIBXML_KEEPENT
that negates the LIBXML_NOENT flag.
Note: This is not an important bug for me, because I will just ditch using
SimpleXML and find another way, but I think it should still be on the books
as a bug.
--
Edit bug report at http://bugs.php.net/?id=49437&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49437&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49437&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49437&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49437&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49437&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49437&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49437&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49437&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49437&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49437&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49437&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49437&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49437&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49437&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49437&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49437&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49437&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49437&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49437&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49437&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49437&r=mysqlcfg