]> granicus.if.org Git - php/commitdiff
Fixed bug #61165 (Segfault - strip_tags())
authorXinchen Hui <laruence@php.net>
Sat, 25 Feb 2012 04:36:08 +0000 (04:36 +0000)
committerXinchen Hui <laruence@php.net>
Sat, 25 Feb 2012 04:36:08 +0000 (04:36 +0000)
NEWS
Zend/zend_API.c

diff --git a/NEWS b/NEWS
index 5a5063d5ce694ab50740af913707921e756e2b9d..0316a823934c18680910fc8fae44afc621b5895b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ PHP                                                                        NEWS
   . World domination
 
 - Core:
+  . Fixed bug #61165 (Segfault - strip_tags()). (Laruence)
   . Fixed bug #61072 (Memory leak when restoring an exception handler).
     (Nikic, Laruence)
   . Fixed bug #61000 (Exceeding max nesting level doesn't delete numerical 
index e6560b224b749d83898d5cc0b9c2350e1177054c..4c0e0f6b2fa678542180ba5f80ec2407742c1ab0 100644 (file)
@@ -262,12 +262,17 @@ ZEND_API int zend_get_object_classname(const zval *object, const char **class_na
 static int parse_arg_object_to_string(zval **arg, char **p, int *pl, int type TSRMLS_DC) /* {{{ */
 {
        if (Z_OBJ_HANDLER_PP(arg, cast_object)) {
-               SEPARATE_ZVAL_IF_NOT_REF(arg);
-               if (Z_OBJ_HANDLER_PP(arg, cast_object)(*arg, *arg, type TSRMLS_CC) == SUCCESS) {
+               zval *obj;
+               ALLOC_ZVAL(obj);
+               MAKE_COPY_ZVAL(arg, obj);
+               if (Z_OBJ_HANDLER_P(*arg, cast_object)(*arg, obj, type TSRMLS_CC) == SUCCESS) {
+                       zval_ptr_dtor(arg);
+                       *arg = obj;
                        *pl = Z_STRLEN_PP(arg);
                        *p = Z_STRVAL_PP(arg);
                        return SUCCESS;
                }
+               zval_ptr_dtor(&obj);
        }
        /* Standard PHP objects */
        if (Z_OBJ_HT_PP(arg) == &std_object_handlers || !Z_OBJ_HANDLER_PP(arg, cast_object)) {