summaryrefslogtreecommitdiff
path: root/ext/simplexml/simplexml.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/simplexml/simplexml.c')
-rw-r--r--ext/simplexml/simplexml.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index fce96bbe72..f70efed368 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -1787,6 +1787,11 @@ static int sxe_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC)
}
}
+ if (readobj == writeobj) {
+ INIT_PZVAL(writeobj);
+ zval_dtor(readobj);
+ }
+
rv = cast_object(writeobj, type, (char *)contents TSRMLS_CC);
if (contents) {