cvs: ZendEngine2 / zend_execute.c zend_vm_def.h zend_vm_execute.h

From: Date: Sat, 26 Jul 2008 14:09:06 +0000
Subject: cvs: ZendEngine2 / zend_execute.c zend_vm_def.h zend_vm_execute.h
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-6940@lists.php.net to get a copy of this message
dmitry Sat Jul 26 14:09:06 2008 UTC Modified files: /ZendEngine2 zend_execute.c zend_vm_def.h zend_vm_execute.h Log: Fixed crashes and memory leak for objects with NULL write_property/has_property/unset_property handlers

http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute.c?r1=1.800&r2=1.801&diff_format=u Index: ZendEngine2/zend_execute.c diff -u ZendEngine2/zend_execute.c:1.800 ZendEngine2/zend_execute.c:1.801 --- ZendEngine2/zend_execute.c:1.800 Tue Jul 8 07:05:03 2008 +++ ZendEngine2/zend_execute.c Sat Jul 26 14:09:05 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.c,v 1.800 2008/07/08 07:05:03 dmitry Exp $ */ +/* $Id: zend_execute.c,v 1.801 2008/07/26 14:09:05 dmitry Exp $ */ #define ZEND_INTENSIVE_DEBUGGING 0 @@ -600,6 +600,11 @@ *retval = EG(uninitialized_zval_ptr); PZVAL_LOCK(*retval); } + if (value_op->op_type == IS_TMP_VAR) { + FREE_ZVAL(value); + } else if (value_op->op_type == IS_CONST) { + zval_ptr_dtor(&value); + } FREE_OP(free_value); return; } http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.237&r2=1.238&diff_format=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.237 ZendEngine2/zend_vm_def.h:1.238 --- ZendEngine2/zend_vm_def.h:1.237 Sat Jul 26 13:14:55 2008 +++ ZendEngine2/zend_vm_def.h Sat Jul 26 14:09:05 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.237 2008/07/26 13:14:55 dmitry Exp $ */ +/* $Id: zend_vm_def.h,v 1.238 2008/07/26 14:09:05 dmitry Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -3608,7 +3608,11 @@ if (IS_OP2_TMP_FREE()) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (IS_OP2_TMP_FREE()) { zval_ptr_dtor(&offset); } else { @@ -4097,9 +4101,19 @@ MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (IS_OP2_TMP_FREE()) { zval_ptr_dtor(&offset); http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.241&r2=1.242&diff_format=u Index: ZendEngine2/zend_vm_execute.h diff -u ZendEngine2/zend_vm_execute.h:1.241 ZendEngine2/zend_vm_execute.h:1.242 --- ZendEngine2/zend_vm_execute.h:1.241 Sat Jul 26 13:14:55 2008 +++ ZendEngine2/zend_vm_execute.h Sat Jul 26 14:09:05 2008 @@ -11112,7 +11112,11 @@ if (0) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (0) { zval_ptr_dtor(&offset); } else { @@ -11223,9 +11227,19 @@ MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (0) { zval_ptr_dtor(&offset); @@ -12940,7 +12954,11 @@ if (1) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (1) { zval_ptr_dtor(&offset); } else { @@ -13051,9 +13069,19 @@ MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (1) { zval_ptr_dtor(&offset); @@ -14815,7 +14843,11 @@ if (0) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (0) { zval_ptr_dtor(&offset); } else { @@ -14926,9 +14958,19 @@ MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (0) { zval_ptr_dtor(&offset); @@ -17306,7 +17348,11 @@ if (0) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (0) { zval_ptr_dtor(&offset); } else { @@ -17417,9 +17463,19 @@ MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (0) { zval_ptr_dtor(&offset); @@ -18531,7 +18587,11 @@ if (0) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (0) { zval_ptr_dtor(&offset); } else { @@ -18641,9 +18701,19 @@ MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (0) { zval_ptr_dtor(&offset); @@ -19602,7 +19672,11 @@ if (1) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (1) { zval_ptr_dtor(&offset); } else { @@ -19712,9 +19786,19 @@ MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (1) { zval_ptr_dtor(&offset); @@ -20673,7 +20757,11 @@ if (0) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (0) { zval_ptr_dtor(&offset); } else { @@ -20783,9 +20871,19 @@ MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (0) { zval_ptr_dtor(&offset); @@ -22013,7 +22111,11 @@ if (0) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (0) { zval_ptr_dtor(&offset); } else { @@ -22123,9 +22225,19 @@ MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (0) { zval_ptr_dtor(&offset); @@ -25141,7 +25253,11 @@ if (0) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (0) { zval_ptr_dtor(&offset); } else { @@ -25251,9 +25367,19 @@ MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (0) { zval_ptr_dtor(&offset); @@ -26847,7 +26973,11 @@ if (1) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (1) { zval_ptr_dtor(&offset); } else { @@ -26957,9 +27087,19 @@ MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (1) { zval_ptr_dtor(&offset); @@ -28599,7 +28739,11 @@ if (0) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (0) { zval_ptr_dtor(&offset); } else { @@ -28709,9 +28853,19 @@ MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (0) { zval_ptr_dtor(&offset); @@ -30855,7 +31009,11 @@ if (0) { MAKE_REAL_ZVAL_PTR(offset); } - Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->unset_property) { + Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to unset property of non-object"); + } if (0) { zval_ptr_dtor(&offset); } else { @@ -30965,9 +31123,19 @@ MAKE_REAL_ZVAL_PTR(offset); } if (prop_dim) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_property) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check property of non-object"); + result = 0; + } } else { - result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (Z_OBJ_HT_P(*container)->has_dimension) { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + zend_error(E_NOTICE, "Trying to check element of non-array"); + result = 0; + } } if (0) { zval_ptr_dtor(&offset);
« previous php.zend-engine.cvs (#6940) next »