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 #64230 (XMLReader does not suppress errors) --EXTENSIONS-- xmlreader --FILE--..

Decoded Output download

--TEST--
Bug #64230 (XMLReader does not suppress errors)
--EXTENSIONS--
xmlreader
--FILE--
<?php
echo "Test
";

function show_internal_errors() {
    foreach (libxml_get_errors() as $error) {
        printf("Internal: %s
", $error->message);
    }
    libxml_clear_errors();
}

echo "Internal errors TRUE
";
libxml_use_internal_errors(true);

$x = new XMLReader;
$x->xml("<root att/>");
$x->read();

show_internal_errors();

echo "Internal errors FALSE
";
libxml_use_internal_errors(false);

$x = new XMLReader;
$x->xml("<root att/>");
$x->read();

show_internal_errors();

?>
Done
--EXPECTF--
Test
Internal errors TRUE
Internal: Specification mandate%A value for attribute att

Internal errors FALSE

Warning: XMLReader::read(): %s: parser error : Specification mandate%A value for attribute att in %s on line %d

Warning: XMLReader::read(): <root att/> in %s on line %d

Warning: XMLReader::read():          ^ in %s on line %d
Done

Did this file decode correctly?

Original Code

--TEST--
Bug #64230 (XMLReader does not suppress errors)
--EXTENSIONS--
xmlreader
--FILE--
<?php
echo "Test\n";

function show_internal_errors() {
    foreach (libxml_get_errors() as $error) {
        printf("Internal: %s\n", $error->message);
    }
    libxml_clear_errors();
}

echo "Internal errors TRUE\n";
libxml_use_internal_errors(true);

$x = new XMLReader;
$x->xml("<root att/>");
$x->read();

show_internal_errors();

echo "Internal errors FALSE\n";
libxml_use_internal_errors(false);

$x = new XMLReader;
$x->xml("<root att/>");
$x->read();

show_internal_errors();

?>
Done
--EXPECTF--
Test
Internal errors TRUE
Internal: Specification mandate%A value for attribute att

Internal errors FALSE

Warning: XMLReader::read(): %s: parser error : Specification mandate%A value for attribute att in %s on line %d

Warning: XMLReader::read(): <root att/> in %s on line %d

Warning: XMLReader::read():          ^ in %s on line %d
Done

Function Calls

libxml_use_internal_errors 1

Variables

None

Stats

MD5 b2a7247deb8ec6687597b3718c46f28d
Eval Count 0
Decode Time 96 ms