diff options
| author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:37:27 -0400 |
|---|---|---|
| committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:37:27 -0400 |
| commit | 2d4e5b09576bb4f0ba716cc82cdf29ea04d9184b (patch) | |
| tree | 41ccc042009cba53e4ce43e727fcba4c1cfbf7f3 /ext/simplexml/tests | |
| parent | d29a4fd2dd3b5d4cf6e80b602544d7b71d794e76 (diff) | |
| download | php-2d4e5b09576bb4f0ba716cc82cdf29ea04d9184b.tar.gz | |
Imported Upstream version 5.2.2upstream/5.2.2
Diffstat (limited to 'ext/simplexml/tests')
| -rwxr-xr-x | ext/simplexml/tests/027.phpt | 3 | ||||
| -rwxr-xr-x | ext/simplexml/tests/bug35785.phpt | 7 | ||||
| -rw-r--r-- | ext/simplexml/tests/bug37386.phpt | 25 | ||||
| -rw-r--r-- | ext/simplexml/tests/bug38347.phpt | 2 | ||||
| -rw-r--r-- | ext/simplexml/tests/bug38406.phpt | 33 | ||||
| -rw-r--r-- | ext/simplexml/tests/bug39662.phpt | 37 | ||||
| -rw-r--r-- | ext/simplexml/tests/bug39760.phpt | 40 | ||||
| -rw-r--r-- | ext/simplexml/tests/bug40451.phpt | 22 | ||||
| -rw-r--r-- | ext/simplexml/tests/bug41175.phpt | 16 |
9 files changed, 182 insertions, 3 deletions
diff --git a/ext/simplexml/tests/027.phpt b/ext/simplexml/tests/027.phpt index f32786c7c..105f99066 100755 --- a/ext/simplexml/tests/027.phpt +++ b/ext/simplexml/tests/027.phpt @@ -71,4 +71,5 @@ Warning: main(): Cannot add element person number 3 when only 2 such elements ex </person> </people> -Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference in %s027.php on line %d +Notice: Indirect modification of overloaded element of SimpleXMLElement has no effect in %s027.php on line %d +===DONE=== diff --git a/ext/simplexml/tests/bug35785.phpt b/ext/simplexml/tests/bug35785.phpt index 096ab7a68..4156a7c9f 100755 --- a/ext/simplexml/tests/bug35785.phpt +++ b/ext/simplexml/tests/bug35785.phpt @@ -25,4 +25,9 @@ echo $xml->asXML(); ===FAIL=== int(0) -Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference in %sbug35785.php on line %d +Notice: Indirect modification of overloaded element of SimpleXMLElement has no effect in %sbug35785.php on line %d + +Strict Standards: Creating default object from empty value in %sbug35785.php on line %d +<?xml version="1.0"?> +<root><bla><posts/></bla></root> +===DONE=== diff --git a/ext/simplexml/tests/bug37386.phpt b/ext/simplexml/tests/bug37386.phpt new file mode 100644 index 000000000..cf8690613 --- /dev/null +++ b/ext/simplexml/tests/bug37386.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #39760 (autocreating element doesn't assign value to first node) +--SKIPIF-- +<?php if (!extension_loaded("simplexml")) print "skip simplexml extension is not loaded"; ?> +--FILE-- +<?php + +$sx1 = new SimpleXMLElement((binary)"<root />"); + +$sx1->node[0] = 'node1'; +$sx1->node[1] = 'node2'; + +print $sx1->asXML()."\n"; +$node = $sx1->node[0]; +$node[0] = 'New Value'; + +print $sx1->asXML(); + +?> +--EXPECTF-- +<?xml version="1.0"?> +<root><node>node1</node><node>node2</node></root> + +<?xml version="1.0"?> +<root><node>New Value</node><node>node2</node></root> diff --git a/ext/simplexml/tests/bug38347.phpt b/ext/simplexml/tests/bug38347.phpt index c25fccea2..0ea7b5d2f 100644 --- a/ext/simplexml/tests/bug38347.phpt +++ b/ext/simplexml/tests/bug38347.phpt @@ -24,5 +24,5 @@ SimpleXMLElement Object ( ) -Warning: iterate(): Node no longer exists in %s on line %d +Warning: Invalid argument supplied for foreach() in %sbug38347.php on line 6 Done diff --git a/ext/simplexml/tests/bug38406.phpt b/ext/simplexml/tests/bug38406.phpt new file mode 100644 index 000000000..f439e33e5 --- /dev/null +++ b/ext/simplexml/tests/bug38406.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #38406 (crash when assigning objects to SimpleXML attributes) +--SKIPIF-- +<?php if (!extension_loaded("simplexml")) print "skip"; ?> +--FILE-- +<?php + +$item = new SimpleXMLElement(b'<something />'); +$item->attribute = b'something'; +var_dump($item->attribute); + +$item->otherAttribute = $item->attribute; +var_dump($item->otherAttribute); + +$a = array(); +$item->$a = new stdclass; + +echo "Done\n"; +?> +--EXPECTF-- +object(SimpleXMLElement)#%d (1) { + [0]=> + string(9) "something" +} +object(SimpleXMLElement)#%d (1) { + [0]=> + string(9) "something" +} + +Notice: Array to string conversion in %s on line %d + +Warning: It is not yet possible to assign complex types to properties in %s on line %d +Done diff --git a/ext/simplexml/tests/bug39662.phpt b/ext/simplexml/tests/bug39662.phpt new file mode 100644 index 000000000..ae15f2ef0 --- /dev/null +++ b/ext/simplexml/tests/bug39662.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #39662 (Segfault when calling asXML() of a cloned SimpleXMLElement) +--SKIPIF-- +<?php if (!extension_loaded("simplexml")) print "skip simplexml extension is not loaded"; ?> +--FILE-- +<?php + +$xml = '<?xml version="1.0" encoding="utf-8" ?> +<test> + +</test>'; + +$root = simplexml_load_string($xml); +$clone = clone $root; +var_dump($root); +var_dump($clone); +var_dump($clone->asXML()); + +echo "Done\n"; +?> +--EXPECTF-- +object(SimpleXMLElement)#%d (1) { + [0]=> + string(2) " + +" +} +object(SimpleXMLElement)#%d (1) { + [0]=> + string(2) " + +" +} +string(15) "<test> + +</test>" +Done diff --git a/ext/simplexml/tests/bug39760.phpt b/ext/simplexml/tests/bug39760.phpt new file mode 100644 index 000000000..e781765fa --- /dev/null +++ b/ext/simplexml/tests/bug39760.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #39760 (cloning fails on nested SimpleXML-Object) +--SKIPIF-- +<?php if (!extension_loaded("simplexml")) print "skip simplexml extension is not loaded"; ?> +--FILE-- +<?php + +$xml = '<?xml version="1.0" ?> +<test> + <level1> + <level2a>text1</level2a> + <level2b>text2</level2b> + </level1> +</test>'; +$test = simplexml_load_string($xml); + +var_dump($test->level1->level2a); + +$test2 = clone $test; +var_dump($test2->level1->level2a); + +$test3 = clone $test->level1->level2a; +var_dump($test3); + +echo "Done\n"; +?> +--EXPECTF-- +object(SimpleXMLElement)#%d (1) { + [0]=> + string(5) "text1" +} +object(SimpleXMLElement)#%d (1) { + [0]=> + string(5) "text1" +} +object(SimpleXMLElement)#%d (1) { + [0]=> + string(5) "text1" +} +Done diff --git a/ext/simplexml/tests/bug40451.phpt b/ext/simplexml/tests/bug40451.phpt new file mode 100644 index 000000000..1a499a731 --- /dev/null +++ b/ext/simplexml/tests/bug40451.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #40451 (addAttribute() may crash when used with non-existent child node) +--FILE-- +<?php + +$string = <<<XML +<?xml version="1.0"?> + <Host enable="true"> + <Name>host.server.com</Name> + </Host> +XML; + +$xml = simplexml_load_string($string); + +$add = $xml->addChild('Host'); +$add->Host->addAttribute('enable', 'true'); + +echo "Done\n"; +?> +--EXPECTF-- +Warning: SimpleXMLElement::addAttribute(): Unable to locate parent Element in %s on line %d +Done diff --git a/ext/simplexml/tests/bug41175.phpt b/ext/simplexml/tests/bug41175.phpt new file mode 100644 index 000000000..51181d29c --- /dev/null +++ b/ext/simplexml/tests/bug41175.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #41175 (addAttribute() fails to add an attribute with an empty value) +--FILE-- +<?php + +$xml = new SimpleXmlElement("<img></img>"); +$xml->addAttribute("src", "foo"); +$xml->addAttribute("alt", ""); +echo $xml->asXML(); + +echo "Done\n"; +?> +--EXPECT-- +<?xml version="1.0"?> +<img src="foo" alt=""/> +Done
\ No newline at end of file |
