summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2006-03-05 15:36:03 +0000
committerAntony Dovgal <tony2001@php.net>2006-03-05 15:36:03 +0000
commita9080d38f49a16ed8bfe3d248b4c23243d93f7f7 (patch)
tree656b27ced2147dee82bd0e1087cd1508245beec1
parent0b12f7307eed2ee7cceefe6750e2047607d73714 (diff)
downloadphp-git-a9080d38f49a16ed8bfe3d248b4c23243d93f7f7.tar.gz
fix #36611 (assignment to SimpleXML object attribute changes argument type to string)
-rw-r--r--NEWS2
-rw-r--r--ext/simplexml/simplexml.c10
2 files changed, 11 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index c9e0466434..2d123abd65 100644
--- a/NEWS
+++ b/NEWS
@@ -36,6 +36,8 @@ PHP NEWS
- Fixed tiger hash algorithm generating wrong results on big endian platforms.
(Mike)
- Fixed crash with DOMImplementation::createDocumentType("name:"). (Mike)
+- Fixed bug #36611 (assignment to SimpleXML object attribute changes argument
+ type to string). (Tony)
- Fixed bug #36606 (pg_query_params() changes arguments type to string). (Tony)
- Fixed bug #36599 (DATE_W3C format constant incorrect). (Derick)
- Fixed bug #36575 (SOAP: Incorrect complex type instantiation with
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 8a321ce0ba..9ba1504188 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -408,7 +408,7 @@ static void sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_boo
int nodendx = 0;
int test = 0;
long cnt;
- zval tmp_zv, trim_zv;
+ zval tmp_zv, trim_zv, value_copy;
if (!member) {
/* This happens when the user did: $sxe[] = $value
@@ -475,6 +475,11 @@ static void sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_boo
case IS_BOOL:
case IS_DOUBLE:
case IS_NULL:
+ if (value->refcount > 1) {
+ value_copy = *value;
+ zval_copy_ctor(&value_copy);
+ value = &value_copy;
+ }
convert_to_string(value);
break;
case IS_STRING:
@@ -566,6 +571,9 @@ next_iter:
if (pnewnode) {
*pnewnode = newnode;
}
+ if (value && value == &value_copy) {
+ zval_dtor(value);
+ }
}
/* }}} */