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-- Testing xpath() with invalid XML --EXTENSIONS-- simplexml --FILE-- <?php // grace..

Decoded Output download

--TEST--
Testing xpath() with invalid XML
--EXTENSIONS--
simplexml
--FILE--
<?php
// gracefully recover from parsing of invalid XML; not available in PHP
const XML_PARSE_RECOVER = 1;

// we're not interested in checking concrete warnings regarding invalid XML
$xml = @simplexml_load_string("XXXXXXX^", 'SimpleXMLElement', XML_PARSE_RECOVER);

// $xml is supposed to hold a SimpleXMLElement, but not FALSE/NULL
try {
    var_dump($xml->xpath("BBBB"));
} catch (Error $e) {
    echo $e->getMessage(), "
";
}
?>
--EXPECT--
SimpleXMLElement is not properly initialized

Did this file decode correctly?

Original Code

--TEST--
Testing xpath() with invalid XML
--EXTENSIONS--
simplexml
--FILE--
<?php
// gracefully recover from parsing of invalid XML; not available in PHP
const XML_PARSE_RECOVER = 1;

// we're not interested in checking concrete warnings regarding invalid XML
$xml = @simplexml_load_string("XXXXXXX^", 'SimpleXMLElement', XML_PARSE_RECOVER);

// $xml is supposed to hold a SimpleXMLElement, but not FALSE/NULL
try {
    var_dump($xml->xpath("BBBB"));
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}
?>
--EXPECT--
SimpleXMLElement is not properly initialized

Function Calls

None

Variables

None

Stats

MD5 7e5872e47b29c5f1ae953bc833176df7
Eval Count 0
Decode Time 82 ms