#42139 [NEW]: XMLReader option constants are broken with respect to open() and XML()

From: Date: Sun, 29 Jul 2007 12:53:06 +0000
Subject: #42139 [NEW]: XMLReader option constants are broken with respect to open() and XML()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-115529@lists.php.net to get a copy of this message
From: gwynne@php.net Operating system: MacOS/Darwin 10.4.10/8.10.1 PHP version: 5CVS-2007-07-29 (CVS) PHP Bug Type: XML related Bug description: XMLReader option constants are broken with respect to open() and XML() Description: ------------ The XMLReader constants for parser options (LOADDTD, SUBST_ENTITIES, etc.) don't work when passed as the third parameter to XMLReader::open() or XMLReader::XML(). Their values are incorrect for the xmlreader API; they're parser property names, not option bitmasks. The XML() method also ignores the options parameter completely. This is partially a documentation problem, but also involves broken functionality in the xmlreader extension. Suggested fix is to either: - remove the options parameters completely from both methods and their documentation - fix the XML() method to read the options and document both functions as using the LIBXML_* constants (fix the docs to match the code), or - modify both XML() and open() to interpret the options passed as properties (fix the code to match the docs) Reproduce code: --------------- <?php $xml = <<<XML <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE root [ <!ELEMENT root ANY> <!ENTITY x "y"> ]> <root>&x;</root> XML; $reader = new XMLReader; $reader->XML( $xml, NULL, XMLReader::SUBST_ENTITIES ); // or: $reader->XML( $xml, NULL, LIBXML_NOENT ); while ( $reader->read() ) echo "{$reader->nodeType}, {$reader->name}, {$reader->value}\n"; $reader->close(); ?> Expected result: ---------------- 10, root, 1, root, 3, #text, y 15, root, Actual result: -------------- 10, root, 1, root, 5, x, 15, root, -- Edit bug report at http://bugs.php.net/?id=42139&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42139&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42139&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42139&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42139&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42139&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42139&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42139&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42139&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42139&r=support Expected behavior: http://bugs.php.net/fix.php?id=42139&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42139&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42139&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42139&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42139&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42139&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42139&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42139&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42139&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42139&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42139&r=mysqlcfg

« previous php.bugs (#115529) next »