xref: /php-src/ext/dom/tests/bug67081.phpt (revision bd9f4fa6)
1--TEST--
2Bug #67081 DOMDocumentType->internalSubset returns entire DOCTYPE tag, not only the subset
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7    $domDocument = new DOMDocument();
8    $domDocument->substituteEntities = true;
9    $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "bug67081_0.xml");
10    var_dump($domDocument->doctype->internalSubset);
11
12    $domDocument = new DOMDocument();
13    $domDocument->substituteEntities = true;
14    $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "bug67081_1.xml");
15    var_dump($domDocument->doctype->internalSubset);
16
17    $domDocument = new DOMDocument();
18    $domDocument->substituteEntities = true;
19    $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "bug67081_2.xml");
20    var_dump($domDocument->doctype->internalSubset);
21
22    $domDocument = new DOMDocument();
23    $domDocument->substituteEntities = true;
24    $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "dom.xml");
25    var_dump($domDocument->doctype->internalSubset);
26?>
27--EXPECT--
28string(19) "<!ELEMENT a EMPTY>
29"
30string(38) "<!ELEMENT a EMPTY>
31<!ELEMENT b EMPTY>
32"
33NULL
34string(277) "<!ENTITY % incent SYSTEM "dom.ent">
35<!ENTITY amp "&#38;#38;">
36<!ENTITY gt "&#62;">
37<!ENTITY % coreattrs "title CDATA #IMPLIED">
38<!ENTITY % attrs "%coreattrs;">
39<!ATTLIST foo bar CDATA #IMPLIED>
40<!ELEMENT foo (#PCDATA)>
41<!ELEMENT root (foo)+>
42<!ATTLIST th title CDATA #IMPLIED>
43"
44