]> granicus.if.org Git - php/commitdiff
new test
authorAntony Dovgal <tony2001@php.net>
Tue, 20 Feb 2007 14:06:05 +0000 (14:06 +0000)
committerAntony Dovgal <tony2001@php.net>
Tue, 20 Feb 2007 14:06:05 +0000 (14:06 +0000)
ext/simplexml/tests/bug38406.phpt [new file with mode: 0644]

diff --git a/ext/simplexml/tests/bug38406.phpt b/ext/simplexml/tests/bug38406.phpt
new file mode 100644 (file)
index 0000000..b449b82
--- /dev/null
@@ -0,0 +1,47 @@
+--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
+--UEXPECTF--
+object(SimpleXMLElement)#%d (1) {
+  [0]=>
+  unicode(9) "something"
+}
+object(SimpleXMLElement)#%d (1) {
+  [0]=>
+  unicode(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