From: Antony Dovgal Date: Thu, 6 Mar 2008 17:28:26 +0000 (+0000) Subject: fix segfault when trying to clone uncloneable object because of zend.ze1_compatibilit... X-Git-Tag: BEFORE_NEW_PARAMETER_PARSE~690 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cbdc4b9af82b786a1a0f56fa2452d7a8dfdb7691;p=php fix segfault when trying to clone uncloneable object because of zend.ze1_compatibility_mode which we should have got rid of years ago --- diff --git a/Zend/tests/clone_uncloneable.phpt b/Zend/tests/clone_uncloneable.phpt new file mode 100644 index 0000000000..1549b344ff --- /dev/null +++ b/Zend/tests/clone_uncloneable.phpt @@ -0,0 +1,20 @@ +--TEST-- +cloning uncloneable object +--SKIPIF-- + +--INI-- +zend.ze1_compatibility_mode=1 +--FILE-- + +--EXPECTF-- +Deprecated: Assigning the return value of new by reference is deprecated in %s on line %d + +Strict Standards: Implicit cloning object of class 'XSLTProcessor' because of 'zend.ze1_compatibility_mode' in %s on line %d + +Fatal error: Trying to clone uncloneable object of class XSLTProcessor in Unknown on line 0 diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 192c4709a1..cfa354a8d5 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -168,9 +168,15 @@ ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_arr *value_ptr = **value; INIT_PZVAL(value_ptr); zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name); + + if (Z_OBJ_HANDLER_PP(value, clone_obj) == NULL) { + zend_error(E_CORE_ERROR, "Trying to clone uncloneable object of class %s", class_name); + } + if(!dup) { efree(class_name); } + value_ptr->value.obj = Z_OBJ_HANDLER_PP(value, clone_obj)(*value TSRMLS_CC); zval_ptr_dtor(value); *value = value_ptr;