1--TEST-- 2Bug #41287 (Writing empty tags with Xmlwriter::WriteElement[ns]) 3--SKIPIF-- 4<?php 5if (!extension_loaded("xmlwriter")) die("skip"); 6?> 7--FILE-- 8<?php 9$xml = new XmlWriter(); 10$xml->openMemory(); 11$xml->setIndent(true); 12$xml->startDocument(); 13$xml->startElement('test'); 14$xml->writeElement('foo', null); 15$xml->writeElement('foo2', ""); 16$xml->writeElement('foo3'); 17$xml->startElement('bar'); 18$xml->endElement(); 19$xml->endElement(); 20print $xml->flush(true); 21 22print "\n"; 23 24$xw = new XMLWriter(); 25$xw->openMemory(); 26$xw->setIndent(true); 27$xw->startDocument(); 28$xw->startElementNS('test', 'test', 'urn:x-test:'); 29$xw->writeElementNS('test', 'foo', null, ''); 30$xw->writeElementNS(null, 'bar', 'urn:x-test:', ''); 31$xw->writeElementNS(null, 'bar', 'urn:x-test:', NULL); 32$xw->writeElementNS(null, 'bar', 'urn:x-test:'); 33$xw->writeElementNS(null, 'bar', '', ''); 34$xw->endElement(); 35$xw->endDocument(); 36print $xw->flush(true); 37?> 38--EXPECT-- 39<?xml version="1.0"?> 40<test> 41 <foo/> 42 <foo2></foo2> 43 <foo3/> 44 <bar/> 45</test> 46 47<?xml version="1.0"?> 48<test:test xmlns:test="urn:x-test:"> 49 <test:foo></test:foo> 50 <bar xmlns="urn:x-test:"></bar> 51 <bar xmlns="urn:x-test:"/> 52 <bar xmlns="urn:x-test:"/> 53 <bar xmlns=""></bar> 54</test:test> 55