summaryrefslogtreecommitdiff
path: root/ext/simplexml
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2008-01-22 20:42:22 +0000
committerMarcus Boerger <helly@php.net>2008-01-22 20:42:22 +0000
commit10a0f206528fd123d75398fc4a44525d4bd54787 (patch)
tree6e6833ef58a5489a0a097efb7e0bf342784a9554 /ext/simplexml
parentde2bb0f497ae40c44456bf7e38c2f961ae60429b (diff)
downloadphp-git-10a0f206528fd123d75398fc4a44525d4bd54787.tar.gz
- MFH Bugfix #37076 (SimpleXML ignores .=). (felipe, marcus)
Diffstat (limited to 'ext/simplexml')
-rw-r--r--ext/simplexml/simplexml.c10
-rw-r--r--ext/simplexml/tests/bug37076.phpt14
2 files changed, 20 insertions, 4 deletions
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===