xref: /PHP-8.0/ext/dom/tests/bug67081.phpt (revision f8d79582)
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--EXPECT--
30string(19) "<!ELEMENT a EMPTY>
31"
32string(38) "<!ELEMENT a EMPTY>
33<!ELEMENT b EMPTY>
34"
35NULL
36string(277) "<!ENTITY % incent SYSTEM "dom.ent">
37<!ENTITY amp "&#38;#38;">
38<!ENTITY gt "&#62;">
39<!ENTITY % coreattrs "title CDATA #IMPLIED">
40<!ENTITY % attrs "%coreattrs;">
41<!ATTLIST foo bar CDATA #IMPLIED>
42<!ELEMENT foo (#PCDATA)>
43<!ELEMENT root (foo)+>
44<!ATTLIST th title CDATA #IMPLIED>
45"
46