]> granicus.if.org Git - php/commitdiff
- Add new test
authorMarcus Boerger <helly@php.net>
Sun, 23 Oct 2005 23:25:46 +0000 (23:25 +0000)
committerMarcus Boerger <helly@php.net>
Sun, 23 Oct 2005 23:25:46 +0000 (23:25 +0000)
ext/simplexml/tests/023.phpt [new file with mode: 0755]

diff --git a/ext/simplexml/tests/023.phpt b/ext/simplexml/tests/023.phpt
new file mode 100755 (executable)
index 0000000..1e919ae
--- /dev/null
@@ -0,0 +1,33 @@
+--TEST--
+SimpleXML: Attributes with entities
+--SKIPIF--
+<?php if (!extension_loaded("simplexml")) print "skip"; ?>
+--FILE--
+<?php 
+
+$xml =<<<EOF
+<?xml version='1.0'?>
+<!DOCTYPE talks SYSTEM "nbsp.dtd" [
+<!ELEMENT root  EMPTY>
+<!ATTLIST root  attr1 CDATA #IMPLIED>
+<!ENTITY  nbsp   "&#38;#x00A0;">
+]>
+<root attr='foo&nbsp;bar&nbsp;baz'></root>
+EOF;
+
+$sxe = simplexml_load_string($xml);
+
+var_dump($sxe);
+var_dump($sxe['attr']);
+?>
+===DONE===
+--EXPECTF--
+object(SimpleXMLElement)#1 (1) {
+  ["attr"]=>
+  string(%d) "foo%sbar%sbaz"
+}
+object(SimpleXMLElement)#2 (1) {
+  [0]=>
+  string(%d) "foo%sbar%sbaz"
+}
+===DONE===