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