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-- GH-12616 (DOM: Removing XMLNS namespace node results in invalid default: prefix) ..
Decoded Output download
--TEST--
GH-12616 (DOM: Removing XMLNS namespace node results in invalid default: prefix)
--EXTENSIONS--
dom
--FILE--
<?php
$doc = new DOMDocument();
$doc->loadXML(
<<<XML
<container xmlns:test="urn:test" xmlns:symfony="http://symfony.com/schema/dic/services">
<symfony:services>
<test:service id="hello" />
</symfony:services>
</container>
XML
);
$doc->documentElement->removeAttributeNS('http://symfony.com/schema/dic/services', 'symfony');
$xpath = new DOMXPath($doc);
$xpath->registerNamespace('test', 'urn:test');
echo $doc->saveXML();
$result = $xpath->query('//container/services/test:service[@id="hello"]');
var_dump($result);
?>
--EXPECT--
<?xml version="1.0"?>
<container xmlns:test="urn:test">
<services>
<test:service id="hello"/>
</services>
</container>
object(DOMNodeList)#4 (1) {
["length"]=>
int(1)
}
Did this file decode correctly?
Original Code
--TEST--
GH-12616 (DOM: Removing XMLNS namespace node results in invalid default: prefix)
--EXTENSIONS--
dom
--FILE--
<?php
$doc = new DOMDocument();
$doc->loadXML(
<<<XML
<container xmlns:test="urn:test" xmlns:symfony="http://symfony.com/schema/dic/services">
<symfony:services>
<test:service id="hello" />
</symfony:services>
</container>
XML
);
$doc->documentElement->removeAttributeNS('http://symfony.com/schema/dic/services', 'symfony');
$xpath = new DOMXPath($doc);
$xpath->registerNamespace('test', 'urn:test');
echo $doc->saveXML();
$result = $xpath->query('//container/services/test:service[@id="hello"]');
var_dump($result);
?>
--EXPECT--
<?xml version="1.0"?>
<container xmlns:test="urn:test">
<services>
<test:service id="hello"/>
</services>
</container>
object(DOMNodeList)#4 (1) {
["length"]=>
int(1)
}
Function Calls
None |
Stats
MD5 | 0b2b92eeff42ecf9297faf83a25f07d6 |
Eval Count | 0 |
Decode Time | 92 ms |