xref: /PHP-7.2/ext/xmlwriter/tests/bug39504.phpt (revision 17ccbeec)
1--TEST--
2Bug #39504 (xmlwriter_write_dtd_entity() creates Attlist tag, not enity)
3--SKIPIF--
4<?php
5if (!extension_loaded("xmlwriter")) die("skip");
6?>
7--FILE--
8<?php
9
10$xw = xmlwriter_open_memory();
11xmlwriter_start_document($xw, NULL, "UTF-8");
12xmlwriter_start_dtd($xw, "root");
13xmlwriter_write_dtd_entity($xw, "ent2", "val2");
14xmlwriter_end_dtd($xw);
15xmlwriter_start_element($xw, "root");
16xmlwriter_end_document($xw);
17print xmlwriter_flush($xw, true);
18print "\n";
19
20$xw = new XMLWriter();
21$xw->openMemory();
22$xw->startDocument(NULL, "UTF-8");
23$xw->startDtd("root");
24$xw->writeDtdEntity("c", NULL, 0, "-//W3C//TEXT copyright//EN", "http://www.w3.org/xmlspec/copyright.xml");
25$xw->endDtd();
26$xw->startElement("root");
27$xw->endDocument();
28print $xw->flush(true);
29
30?>
31--EXPECTF--
32<?xml version="1.0" encoding="UTF-8"?>
33<!DOCTYPE root [<!ENTITY ent2 "val2">]><root/>
34
35<?xml version="1.0" encoding="UTF-8"?>
36<!DOCTYPE root [<!ENTITY c PUBLIC "-//W3C//TEXT copyright//EN" "http://www.w3.org/xmlspec/copyright.xml">]><root/>
37