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