From 10a0f206528fd123d75398fc4a44525d4bd54787 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Tue, 22 Jan 2008 20:42:22 +0000 Subject: [PATCH] - MFH Bugfix #37076 (SimpleXML ignores .=). (felipe, marcus) --- NEWS | 1 + ext/simplexml/simplexml.c | 10 ++++++---- ext/simplexml/tests/bug37076.phpt | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 ext/simplexml/tests/bug37076.phpt 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-- +"); +$xml->foo = "foo"; +$xml->foo .= "bar"; +print $xml->asXML(); +?> +===DONE=== +--EXPECT-- + +foobar +===DONE=== -- 2.40.0