Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- Bug #42139 (XMLReader option constants are broken using XML()) --EXTENSIONS-- xml..

Decoded Output download

--TEST--
Bug #42139 (XMLReader option constants are broken using XML())
--EXTENSIONS--
xmlreader
--FILE--
<?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, LIBXML_NOENT);
while ( $reader->read() ) {
  echo "{$reader->nodeType}, {$reader->name}, {$reader->value}
";
}
$reader->close();

?>
--EXPECT--
10, root, 
1, root, 
3, #text, y
15, root, 

Did this file decode correctly?

Original Code

--TEST--
Bug #42139 (XMLReader option constants are broken using XML())
--EXTENSIONS--
xmlreader
--FILE--
<?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, LIBXML_NOENT);
while ( $reader->read() ) {
  echo "{$reader->nodeType}, {$reader->name}, {$reader->value}\n";
}
$reader->close();

?>
--EXPECT--
10, root, 
1, root, 
3, #text, y
15, root, 

Function Calls

None

Variables

$xml <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE root [ <!EL..

Stats

MD5 fdee39ec9a3d232a97482c3a81082ba5
Eval Count 0
Decode Time 90 ms