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-- XMLReader: Expand into existing DOM documet --EXTENSIONS-- xmlreader dom --SKIPIF..

Decoded Output download

--TEST--
XMLReader: Expand into existing DOM documet
--EXTENSIONS--
xmlreader
dom
--SKIPIF--
<?php $reader = new XMLReader();
if (!method_exists($reader, 'expand')) print "skip";
?>
--FILE--
<?php

$basexml = '<?xml version="1.0" encoding="UTF-8"?>
<books><book>base book</book></books>';

$xmlstring = '<?xml version="1.0" encoding="UTF-8"?>
<books><book>new book</book></books>';

$dom = new DOMDocument();
$dom->loadXML($basexml);

$reader = new XMLReader();
$reader->XML($xmlstring);
while ($reader->read()) {
    if ($reader->localName == "book") {
        $node = $reader->expand($dom);
        if ($node->ownerDocument) {
            echo $node->ownerDocument->documentElement->firstChild->textContent . "
";
        }
        break;
    }
}
$reader->close();
?>
--EXPECT--
base book

Did this file decode correctly?

Original Code

--TEST--
XMLReader: Expand into existing DOM documet
--EXTENSIONS--
xmlreader
dom
--SKIPIF--
<?php $reader = new XMLReader();
if (!method_exists($reader, 'expand')) print "skip";
?>
--FILE--
<?php

$basexml = '<?xml version="1.0" encoding="UTF-8"?>
<books><book>base book</book></books>';

$xmlstring = '<?xml version="1.0" encoding="UTF-8"?>
<books><book>new book</book></books>';

$dom = new DOMDocument();
$dom->loadXML($basexml);

$reader = new XMLReader();
$reader->XML($xmlstring);
while ($reader->read()) {
    if ($reader->localName == "book") {
        $node = $reader->expand($dom);
        if ($node->ownerDocument) {
            echo $node->ownerDocument->documentElement->firstChild->textContent . "\n";
        }
        break;
    }
}
$reader->close();
?>
--EXPECT--
base book

Function Calls

None

Variables

None

Stats

MD5 a7a94e3cccdd8cc72f8e60e24f98903e
Eval Count 0
Decode Time 84 ms