cvs: ZendEngine2(PHP_5_3) / zend_API.c /tests clone_uncloneable.phpt
[email protected] ("Antony Dovgal")
| Newsgroups | php.zend-engine.cvs |
|---|---|
| Message-ID | <cvstony20011204824506@cvsserver> |
tony2001 Thu Mar 6 17:28:26 2008 UTC
Added files: (Branch: PHP_5_3)
/ZendEngine2/tests clone_uncloneable.phpt
Modified files:
/ZendEngine2 zend_API.c
Log:
fix segfault when trying to clone uncloneable object because of zend.ze1_compatibility_mode which we should have got rid of years ago
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.c?r1=1.296.2.27.2.34.2.30&r2=1.296.2.27.2.34.2.31&diff_format=u
Index: ZendEngine2/zend_API.c
diff -u ZendEngine2/zend_API.c:1.296.2.27.2.34.2.30 ZendEngine2/zend_API.c:1.296.2.27.2.34.2.31
--- ZendEngine2/zend_API.c:1.296.2.27.2.34.2.30 Tue Feb 19 06:52:43 2008
+++ ZendEngine2/zend_API.c Thu Mar 6 17:28:26 2008
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_API.c,v 1.296.2.27.2.34.2.30 2008/02/19 06:52:43 sebastian Exp $ */
+/* $Id: zend_API.c,v 1.296.2.27.2.34.2.31 2008/03/06 17:28:26 tony2001 Exp $ */
#include "zend.h"
#include "zend_execute.h"
@@ -168,9 +168,15 @@
*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;
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/clone_uncloneable.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/clone_uncloneable.phpt
+++ ZendEngine2/tests/clone_uncloneable.phpt