1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
--TEST--
Importing an entity reference without also importing the document
--EXTENSIONS--
dom
--FILE--
<?php
$dom = Dom\XMLDocument::createFromString(<<<XML
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY foo "bar">
]>
<root>&foo;</root>
XML);
$importer = Dom\XMLDocument::createEmpty();
$imported = $importer->importNode($dom->documentElement, true);
echo $importer->saveXml($imported), "\n";
var_dump($imported->firstChild);
?>
--EXPECT--
<root>&foo;</root>
object(Dom\EntityReference)#3 (14) {
["nodeType"]=>
int(5)
["nodeName"]=>
string(3) "foo"
["baseURI"]=>
string(11) "about:blank"
["isConnected"]=>
bool(false)
["ownerDocument"]=>
string(22) "(object value omitted)"
["parentNode"]=>
string(22) "(object value omitted)"
["parentElement"]=>
string(22) "(object value omitted)"
["childNodes"]=>
string(22) "(object value omitted)"
["firstChild"]=>
NULL
["lastChild"]=>
NULL
["previousSibling"]=>
NULL
["nextSibling"]=>
NULL
["nodeValue"]=>
NULL
["textContent"]=>
NULL
}
|