diff options
author | Rob Richards <rrichards@php.net> | 2007-05-04 20:16:39 +0000 |
---|---|---|
committer | Rob Richards <rrichards@php.net> | 2007-05-04 20:16:39 +0000 |
commit | 78ccf4e0c232fe319c3036d4095b6bcbddd481a0 (patch) | |
tree | 8c2853c36dab4e81ec2b7907080eb5e34407c7c6 /ext/xmlwriter/tests | |
parent | 3585581412389845c674809726b377006b2d99b1 (diff) | |
download | php-git-78ccf4e0c232fe319c3036d4095b6bcbddd481a0.tar.gz |
Fix bug #41287 (Namespace functions don't allow xmlns to be optional)
add test
Diffstat (limited to 'ext/xmlwriter/tests')
-rw-r--r-- | ext/xmlwriter/tests/bug41287.phpt | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/ext/xmlwriter/tests/bug41287.phpt b/ext/xmlwriter/tests/bug41287.phpt new file mode 100644 index 0000000000..106ac3a3ec --- /dev/null +++ b/ext/xmlwriter/tests/bug41287.phpt @@ -0,0 +1,43 @@ +--TEST-- +Bug #41287 (Namespace functions don't allow xmlns defintion to be optional) +--FILE-- +<?php + +$xw = xmlwriter_open_memory(); +xmlwriter_set_indent($xw, true); +xmlwriter_start_document($xw); +xmlwriter_start_element_ns($xw, 'test', 'test', 'urn:x-test:'); +xmlwriter_write_element_ns($xw, 'test', 'foo', null, ''); +xmlwriter_write_element_ns($xw, null, 'bar', 'urn:x-test:', ''); +xmlwriter_write_element_ns($xw, null, 'bar', '', ''); +xmlwriter_end_element($xw); +xmlwriter_end_document($xw); +print xmlwriter_flush($xw, true); +print "\n"; + +$xw = new XMLWriter(); +$xw->openMemory(); +$xw->setIndent(true); +$xw->startDocument(); +$xw->startElementNS('test', 'test', 'urn:x-test:'); +$xw->writeElementNS('test', 'foo', null, ''); +$xw->writeElementNS(null, 'bar', 'urn:x-test:', ''); +$xw->writeElementNS(null, 'bar', '', ''); +$xw->endElement(); +$xw->endDocument(); +print $xw->flush(true); +?> +--EXPECTF-- +<?xml version="1.0"?> +<test:test xmlns:test="urn:x-test:"> + <test:foo></test:foo> + <bar xmlns="urn:x-test:"></bar> + <bar xmlns=""></bar> +</test:test> + +<?xml version="1.0"?> +<test:test xmlns:test="urn:x-test:"> + <test:foo></test:foo> + <bar xmlns="urn:x-test:"></bar> + <bar xmlns=""></bar> +</test:test> |