]> granicus.if.org Git - php/commitdiff
- Bugfix #37076 (SimpleXML ignores .=). (felipe, marcus)
authorMarcus Boerger <helly@php.net>
Tue, 22 Jan 2008 20:40:30 +0000 (20:40 +0000)
committerMarcus Boerger <helly@php.net>
Tue, 22 Jan 2008 20:40:30 +0000 (20:40 +0000)
ext/simplexml/simplexml.c
ext/simplexml/tests/bug37076.phpt [new file with mode: 0644]

index 5895460ef6b05e22cea4e8501a6352cf5a1ed6f5..1c65a72fe6b9273a7336c07d5de8cc8d141b2a26 100644 (file)
@@ -719,11 +719,13 @@ static zval** sxe_property_get_adr(zval *object, zval *member TSRMLS_DC) /* {{{
 
        name = Z_STRVAL_P(member);
        node = sxe_get_element_by_name(sxe, node, &name, &type TSRMLS_CC);
-       if (!node) {
-               sxe_prop_dim_write(object, member, NULL, 1, 0, &node TSRMLS_CC);
-               type = SXE_ITER_NONE;
-               name = NULL;
+       if (node) {
+               return NULL;
        }
+       sxe_prop_dim_write(object, member, NULL, 1, 0, &node TSRMLS_CC);
+       type = SXE_ITER_NONE;
+       name = NULL;
+
        MAKE_STD_ZVAL(return_value);
        _node_as_zval(sxe, node, return_value, type, name, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC);
 
diff --git a/ext/simplexml/tests/bug37076.phpt b/ext/simplexml/tests/bug37076.phpt
new file mode 100644 (file)
index 0000000..a5b3801
--- /dev/null
@@ -0,0 +1,14 @@
+--TEST--
+Bug #37076 (SimpleXML ignores .=)
+--FILE--
+<?php
+$xml = simplexml_load_string("<root><foo /></root>");
+$xml->foo = "foo";
+$xml->foo .= "bar";
+print $xml->asXML();
+?>
+===DONE===
+--EXPECT--
+<?xml version="1.0"?>
+<root><foo>foobar</foo></root>
+===DONE===