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

diff --git a/NEWS b/NEWS
index 047af8cf28bd88e2a81e4f130030ae9c665dcaa9..547098df9e06b1ac79a35fb15c71b76bf0a0de7a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -126,6 +126,7 @@ PHP                                                                        NEWS
 - Fixed bug #37964 (Reflection shows private methods of parent class).
   (Felipe, Marcus)
 - Fixed bug #37911 (preg_replace_callback() ignores named groups). (Nuno)
+- Fixed bug #37076 (SimpleXML ignores .=). (Felipe, Marcus)
 - Fixed bug #36128 (Interbase PDO - timestamp columns return NULL). (Lars W)
 - Fixed bug #35386 (firebird: first row is null). (Lars W)
 - Fixed bug #35163 (Array elements can lose references). (Dmitry)
index ff78d29a1f826da0d9ebb4c38c1fd3cb2bc22997..336707c8fffe6abdbd6561da33ffd0a0685c6f43 100644 (file)
@@ -711,11 +711,13 @@ static zval** sxe_property_get_adr(zval *object, zval *member TSRMLS_DC) /* {{{
        convert_to_string(member);
        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===