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-- replaceChild() where the old node is not a child --EXTENSIONS-- dom --FILE-- <?ph..

Decoded Output download

--TEST--
replaceChild() where the old node is not a child
--EXTENSIONS--
dom
--FILE--
<?php
$document = new DOMDocument();
$real_parent = $document->createElement('real');
$parent = $document->createElement('p');
$child1 = $document->createElement('child1');
$child2 = $document->createElement('child2');
$child3 = $document->createElement('child3');
$real_parent->appendChild($child1);
$parent->appendChild($child2);
try {
	$parent->replaceChild($child3, $child1);
} catch (DOMException $e) {
	echo "DOMException: " . $e->getMessage();
}
--EXPECT--
DOMException: Not Found Error
 ?>

Did this file decode correctly?

Original Code

--TEST--
replaceChild() where the old node is not a child
--EXTENSIONS--
dom
--FILE--
<?php
$document = new DOMDocument();
$real_parent = $document->createElement('real');
$parent = $document->createElement('p');
$child1 = $document->createElement('child1');
$child2 = $document->createElement('child2');
$child3 = $document->createElement('child3');
$real_parent->appendChild($child1);
$parent->appendChild($child2);
try {
	$parent->replaceChild($child3, $child1);
} catch (DOMException $e) {
	echo "DOMException: " . $e->getMessage();
}
--EXPECT--
DOMException: Not Found Error

Function Calls

None

Variables

None

Stats

MD5 7ceedb143fe1f9097aa7a8463d36b4da
Eval Count 0
Decode Time 87 ms