com php-src: added failing tests for bug #62639, bug #67116, bug #69169 and bug #69491: ext/simplexml/tests/bug62639.phpt
ext/simplexml/tests/bug67116.phpt ext/simplexml/tests/bug69169.phpt ext/simplexml/tests/bug69491.phpt
| From: | Anatol Belski | Date: | Fri, 29 May 2015 18:43:33 +0000 |
| Subject: | com php-src: added failing tests for bug #62639, bug #67116, bug #69169 and bug #69491: ext/simplexml/tests/bug62639.phpt ext/simplexml/tests/bug67116.phpt ext/simplexml/tests/bug69169.phpt ext/simplexml/tests/bug69491.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-87001@lists.php.net to get a copy of this message | ||
Commit: 1a3a674ee64e8174c54d5e33a3cee1f7125f35a7
Author: Christoph M. Becker <cmbecker69@gmx.de> Tue, 26 May 2015 18:32:08 +0200
Committer: Anatol Belski <ab@php.net> Fri, 29 May 2015 20:43:33 +0200
Parents: bcd5853a0beea544b2869a5a2467ed44242abb99
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1a3a674ee64e8174c54d5e33a3cee1f7125f35a7
Log:
added failing tests for bug #62639, bug #67116, bug #69169 and bug #69491
Bugs:
https://bugs.php.net/62639
https://bugs.php.net/67116
https://bugs.php.net/69169
https://bugs.php.net/69491
Changed paths:
A ext/simplexml/tests/bug62639.phpt
A ext/simplexml/tests/bug67116.phpt
A ext/simplexml/tests/bug69169.phpt
A ext/simplexml/tests/bug69491.phpt
Diff:
diff --git a/ext/simplexml/tests/bug62639.phpt b/ext/simplexml/tests/bug62639.phpt
new file mode 100644
index 0000000..4a4e157
--- /dev/null
+++ b/ext/simplexml/tests/bug62639.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Bug #62639 (XML structure broken)
+--SKIPIF--
+<?php
+if (!extension_loaded("simplexml")) die("skip SimpleXML not available");
+?>
+--FILE--
+<?php
+
+class A extends SimpleXMLElement
+{
+}
+
+$xml1 = <<<XML
+<?xml version="1.0"?>
+<a>
+ <b>
+ <c>
+ <value attr="Some Attr">Some Value</value>
+ </c>
+ </b>
+</a>
+XML;
+
+$a1 = new A($xml1);
+
+foreach ($a1->b->c->children() as $key => $value) {
+ var_dump($value);
+}
+
+$xml2 = <<<XML
+<?xml version="1.0"?>
+<a>
+ <b>
+ <c><value attr="Some Attr">Some Value</value></c>
+ </b>
+</a>
+XML;
+
+$a2 = new A($xml2);
+
+foreach ($a2->b->c->children() as $key => $value) {
+ var_dump($value);
+}?>
+--EXPECT--
+object(A)#2 (2) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr"]=>
+ string(9) "Some Attr"
+ }
+ [0]=>
+ string(10) "Some Value"
+}
+object(A)#3 (2) {
+ ["@attributes"]=>
+ array(1) {
+ ["attr"]=>
+ string(9) "Some Attr"
+ }
+ [0]=>
+ string(10) "Some Value"
+}
\ No newline at end of file
diff --git a/ext/simplexml/tests/bug67116.phpt b/ext/simplexml/tests/bug67116.phpt
new file mode 100644
index 0000000..774e43c
--- /dev/null
+++ b/ext/simplexml/tests/bug67116.phpt
@@ -0,0 +1,93 @@
+--TEST--
+Bug #67116 (Inconsistent parsing of Nodes w/o linefeed)
+--SKIPIF--
+<?php
+if (!extension_loaded("simplexml")) die("skip SimpleXML not available");
+?>
+--FILE--
+<?php
+
+$xml = <<<XML
+<?xml version="1.0" encoding="UTF-8"?>
+<aa>
+ <bs>
+ <b>b</b>
+ </bs>
+ <cs><c>b</c></cs>
+ <ds><d id="d"></d></ds>
+ <es>
+ <e id="e"></e>
+ </es>
+ <fs><f id="f"></f><f id="f"></f></fs>
+</aa>
+XML;
+$sxe = simplexml_load_string($xml);
+print_r($sxe);
+
+?>
+--EXPECT--
+SimpleXMLElement Object
+(
+ [bs] => SimpleXMLElement Object
+ (
+ [b] => b
+ )
+
+ [cs] => SimpleXMLElement Object
+ (
+ [c] => b
+ )
+
+ [ds] => SimpleXMLElement Object
+ (
+ [d] => SimpleXMLElement Object
+ (
+ [@attributes] => Array
+ (
+ [id] => d
+ )
+
+ )
+
+ )
+
+ [es] => SimpleXMLElement Object
+ (
+ [e] => SimpleXMLElement Object
+ (
+ [@attributes] => Array
+ (
+ [id] => e
+ )
+
+ )
+
+ )
+
+ [fs] => SimpleXMLElement Object
+ (
+ [f] => Array
+ (
+ [0] => SimpleXMLElement Object
+ (
+ [@attributes] => Array
+ (
+ [id] => f
+ )
+
+ )
+
+ [1] => SimpleXMLElement Object
+ (
+ [@attributes] => Array
+ (
+ [id] => f
+ )
+
+ )
+
+ )
+
+ )
+
+)
diff --git a/ext/simplexml/tests/bug69169.phpt b/ext/simplexml/tests/bug69169.phpt
new file mode 100644
index 0000000..08cf299
--- /dev/null
+++ b/ext/simplexml/tests/bug69169.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Bug #69169 (simplexml_load_string parse wrongly when xml given in one row)
+--SKIPIF--
+<?php
+if (!extension_loaded("simplexml")) die("skip SimpleXML not available");
+?>
+--FILE--
+<?php
+$a = '<?xml version="1.0" encoding="UTF-8"?>
+<root a="b">
+ <row b="y">
+ <item s="t" />
+ </row>
+ <row p="c">
+ <item y="n" />
+ </row>
+</root>';
+$b = str_replace(array("\n", "\r", "\t"), "", $a);
+$simple_xml = simplexml_load_string($b);
+print_r($simple_xml);
+?>
+--EXPECT--
+SimpleXMLElement Object
+(
+ [@attributes] => Array
+ (
+ [a] => b
+ )
+
+ [row] => Array
+ (
+ [0] => SimpleXMLElement Object
+ (
+ [@attributes] => Array
+ (
+ [b] => y
+ )
+
+ [item] => SimpleXMLElement Object
+ (
+ [@attributes] => Array
+ (
+ [s] => t
+ )
+
+ )
+
+ )
+
+ [1] => SimpleXMLElement Object
+ (
+ [@attributes] => Array
+ (
+ [p] => c
+ )
+
+ [item] => SimpleXMLElement Object
+ (
+ [@attributes] => Array
+ (
+ [y] => n
+ )
+
+ )
+
+ )
+
+ )
+
+)
diff --git a/ext/simplexml/tests/bug69491.phpt b/ext/simplexml/tests/bug69491.phpt
new file mode 100644
index 0000000..b48a40b
--- /dev/null
+++ b/ext/simplexml/tests/bug69491.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #69491 (simplexml doesn't correctly parse empty nodes on same line as another node)
+--SKIPIF--
+<?php
+if (!extension_loaded("simplexml")) die("skip SimpleXML not available");
+?>
+--FILE--
+<?php
+var_dump(simplexml_load_string('<a>
+ <b><c/></b>
+</a>'));?>
+--EXPECT--
+object(SimpleXMLElement)#1 (1) {
+ ["b"]=>
+ object(SimpleXMLElement)#2 (1) {
+ ["c"]=>
+ object(SimpleXMLElement)#3 (0) {
+ }
+ }
+}