summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--ext/simplexml/simplexml.c10
-rw-r--r--ext/simplexml/tests/bug37076.phpt14
3 files changed, 21 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 047af8cf28..547098df9e 100644
--- 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)
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index ff78d29a1f..336707c8ff 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -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
index 0000000000..a5b3801ccb
--- /dev/null
+++ b/ext/simplexml/tests/bug37076.phpt
@@ -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===