cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h zend_vm_opcodes.h /tests bug33318.phpt php-src NEWS

From: Date: Thu, 16 Jun 2005 14:20:00 +0000
Subject: cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h zend_vm_opcodes.h /tests bug33318.phpt php-src NEWS
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-3811@lists.php.net to get a copy of this message
dmitry Thu Jun 16 10:20:00 2005 EDT Added files: /ZendEngine2/tests bug33318.phpt Modified files: /php-src NEWS /ZendEngine2 zend_vm_def.h zend_vm_execute.h zend_vm_opcodes.h Log: Fixed bug #33318 (throw 1; results in Invalid opcode 108/1/8)

http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1920&r2=1.1921&ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1920 php-src/NEWS:1.1921 --- php-src/NEWS:1.1920 Tue Jun 14 18:19:50 2005 +++ php-src/NEWS Thu Jun 16 10:19:58 2005 @@ -9,6 +9,7 @@ - Fixed PECL bug #3714 (beginTransaction doesn't work if you're in auto-commit mode). (Wez) - Fixed bug #33340 (CLI Crash when calling php:function from XSLT). (Rob) +- Fixed bug #33318 (throw 1; results in Invalid opcode 108/1/8). (Dmitry) - Fixed bug #33312 (ReflectionParameter methods do not work correctly). (Dmitry) - Fixed bug #33212 ([GCC 4]: 'zend_error_noreturn' aliased to external symbol http://cvs.php.net/diff.php/ZendEngine2/zend_vm_def.h?r1=1.39&r2=1.40&ty=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.39 ZendEngine2/zend_vm_def.h:1.40 --- ZendEngine2/zend_vm_def.h:1.39 Thu Jun 16 08:26:43 2005 +++ ZendEngine2/zend_vm_def.h Thu Jun 16 10:19:59 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.39 2005/06/16 12:26:43 dmitry Exp $ */ +/* $Id: zend_vm_def.h,v 1.40 2005/06/16 14:19:59 dmitry Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -1734,9 +1734,6 @@ zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope)); if (OP2_TYPE == IS_CONST) { -#ifndef ZEND_VM_SPEC - free_op2.var = NULL; -#endif function_name_strval = opline->op2.u.constant.value.str.val; function_name_strlen = opline->op2.u.constant.value.str.len; } else { @@ -1756,7 +1753,9 @@ } efree(lcname); - FREE_OP2(); + if (OP2_TYPE != IS_CONST) { + FREE_OP2(); + } EX(calling_scope) = function->common.scope; EX(object) = NULL; @@ -2045,7 +2044,7 @@ ZEND_VM_RETURN_FROM_EXECUTE_LOOP(); } -ZEND_VM_HANDLER(108, ZEND_THROW, VAR|CV, ANY) +ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY) { zend_op *opline = EX(opline); zval *value; @@ -3380,13 +3379,11 @@ ZEND_VM_HANDLER(79, ZEND_EXIT, CONST|TMP|VAR|UNUSED|CV, ANY) { - zend_op *opline = EX(opline); - if (OP1_TYPE != IS_UNUSED) { - zval *ptr; + zend_op *opline = EX(opline); zend_free_op free_op1; + zval *ptr = GET_OP1_ZVAL_PTR(BP_VAR_R); - ptr = GET_OP1_ZVAL_PTR(BP_VAR_R); if (Z_TYPE_P(ptr) == IS_LONG) { EG(exit_status) = Z_LVAL_P(ptr); } else { http://cvs.php.net/diff.php/ZendEngine2/zend_vm_execute.h?r1=1.41&r2=1.42&ty=u Index: ZendEngine2/zend_vm_execute.h diff -u ZendEngine2/zend_vm_execute.h:1.41 ZendEngine2/zend_vm_execute.h:1.42 --- ZendEngine2/zend_vm_execute.h:1.41 Thu Jun 16 08:26:43 2005 +++ ZendEngine2/zend_vm_execute.h Thu Jun 16 10:19:59 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_execute.h,v 1.41 2005/06/16 12:26:43 dmitry Exp $ */ +/* $Id: zend_vm_execute.h,v 1.42 2005/06/16 14:19:59 dmitry Exp $ */ static opcode_handler_t zend_user_opcode_handlers[256] = {(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL}; @@ -659,14 +659,11 @@ zend_function *function; char *function_name_strval, *lcname; int function_name_strlen; - zend_free_op free_op2; + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope)); if (IS_CONST == IS_CONST) { -#if 0 - free_op2.var = NULL; -#endif function_name_strval = opline->op2.u.constant.value.str.val; function_name_strlen = opline->op2.u.constant.value.str.len; } else { @@ -686,6 +683,9 @@ } efree(lcname); + if (IS_CONST != IS_CONST) { + + } EX(calling_scope) = function->common.scope; EX(object) = NULL; @@ -861,9 +861,6 @@ zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope)); if (IS_TMP_VAR == IS_CONST) { -#if 0 - free_op2.var = NULL; -#endif function_name_strval = opline->op2.u.constant.value.str.val; function_name_strlen = opline->op2.u.constant.value.str.len; } else { @@ -883,7 +880,9 @@ } efree(lcname); - zval_dtor(free_op2.var); + if (IS_TMP_VAR != IS_CONST) { + zval_dtor(free_op2.var); + } EX(calling_scope) = function->common.scope; EX(object) = NULL; @@ -1016,9 +1015,6 @@ zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope)); if (IS_VAR == IS_CONST) { -#if 0 - free_op2.var = NULL; -#endif function_name_strval = opline->op2.u.constant.value.str.val; function_name_strlen = opline->op2.u.constant.value.str.len; } else { @@ -1038,7 +1034,9 @@ } efree(lcname); - if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + if (IS_VAR != IS_CONST) { + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; + } EX(calling_scope) = function->common.scope; EX(object) = NULL; @@ -1248,14 +1246,11 @@ zend_function *function; char *function_name_strval, *lcname; int function_name_strlen; - zend_free_op free_op2; + zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope)); if (IS_CV == IS_CONST) { -#if 0 - free_op2.var = NULL; -#endif function_name_strval = opline->op2.u.constant.value.str.val; function_name_strlen = opline->op2.u.constant.value.str.len; } else { @@ -1275,6 +1270,9 @@ } efree(lcname); + if (IS_CV != IS_CONST) { + + } EX(calling_scope) = function->common.scope; EX(object) = NULL; @@ -1665,6 +1663,30 @@ ZEND_VM_RETURN_FROM_EXECUTE_LOOP(); } +static int ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zval *value; + zval *exception; + + + value = &opline->op1.u.constant; + + if (value->type != IS_OBJECT) { + zend_error_noreturn(E_ERROR, "Can only throw objects"); + } + /* Not sure if a complete copy is what we want here */ + ALLOC_ZVAL(exception); + INIT_PZVAL_COPY(exception, value); + if (!0) { + zval_copy_ctor(exception); + } + + zend_throw_exception_object(exception TSRMLS_CC); + + ZEND_VM_NEXT_OPCODE(); +} + static int ZEND_SEND_VAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -2140,13 +2162,11 @@ static int ZEND_EXIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { - zend_op *opline = EX(opline); - if (IS_CONST != IS_UNUSED) { - zval *ptr; + zend_op *opline = EX(opline); + zval *ptr = &opline->op1.u.constant; - ptr = &opline->op1.u.constant; if (Z_TYPE_P(ptr) == IS_LONG) { EG(exit_status) = Z_LVAL_P(ptr); } else { @@ -4042,6 +4062,30 @@ ZEND_VM_RETURN_FROM_EXECUTE_LOOP(); } +static int ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_op *opline = EX(opline); + zval *value; + zval *exception; + zend_free_op free_op1; + + value = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); + + if (value->type != IS_OBJECT) { + zend_error_noreturn(E_ERROR, "Can only throw objects"); + } + /* Not sure if a complete copy is what we want here */ + ALLOC_ZVAL(exception); + INIT_PZVAL_COPY(exception, value); + if (!1) { + zval_copy_ctor(exception); + } + + zend_throw_exception_object(exception TSRMLS_CC); + + ZEND_VM_NEXT_OPCODE(); +} + static int ZEND_SEND_VAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); @@ -4525,13 +4569,11 @@ static int ZEND_EXIT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { - zend_op *opline = EX(opline); - if (IS_TMP_VAR != IS_UNUSED) { - zval *ptr; + zend_op *opline = EX(opline); zend_free_op free_op1; + zval *ptr = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - ptr = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); if (Z_TYPE_P(ptr) == IS_LONG) { EG(exit_status) = Z_LVAL_P(ptr); } else { @@ -7676,13 +7718,11 @@ static int ZEND_EXIT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { - zend_op *opline = EX(opline); - if (IS_VAR != IS_UNUSED) { - zval *ptr; + zend_op *opline = EX(opline); zend_free_op free_op1; + zval *ptr = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - ptr = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); if (Z_TYPE_P(ptr) == IS_LONG) { EG(exit_status) = Z_LVAL_P(ptr); } else { @@ -13891,13 +13931,11 @@ static int ZEND_EXIT_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { - zend_op *opline = EX(opline); - if (IS_UNUSED != IS_UNUSED) { - zval *ptr; + zend_op *opline = EX(opline); + zval *ptr = NULL; - ptr = NULL; if (Z_TYPE_P(ptr) == IS_LONG) { EG(exit_status) = Z_LVAL_P(ptr); } else { @@ -19544,13 +19582,11 @@ static int ZEND_EXIT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { - zend_op *opline = EX(opline); - if (IS_CV != IS_UNUSED) { - zval *ptr; + zend_op *opline = EX(opline); + zval *ptr = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); - ptr = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); if (Z_TYPE_P(ptr) == IS_LONG) { EG(exit_status) = Z_LVAL_P(ptr); } else { @@ -28376,16 +28412,16 @@ ZEND_CATCH_SPEC_HANDLER, ZEND_CATCH_SPEC_HANDLER, ZEND_CATCH_SPEC_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, + ZEND_THROW_SPEC_CONST_HANDLER, + ZEND_THROW_SPEC_CONST_HANDLER, + ZEND_THROW_SPEC_CONST_HANDLER, + ZEND_THROW_SPEC_CONST_HANDLER, + ZEND_THROW_SPEC_CONST_HANDLER, + ZEND_THROW_SPEC_TMP_HANDLER, + ZEND_THROW_SPEC_TMP_HANDLER, + ZEND_THROW_SPEC_TMP_HANDLER, + ZEND_THROW_SPEC_TMP_HANDLER, + ZEND_THROW_SPEC_TMP_HANDLER, ZEND_THROW_SPEC_VAR_HANDLER, ZEND_THROW_SPEC_VAR_HANDLER, ZEND_THROW_SPEC_VAR_HANDLER, http://cvs.php.net/diff.php/ZendEngine2/zend_vm_opcodes.h?r1=1.28&r2=1.29&ty=u Index: ZendEngine2/zend_vm_opcodes.h diff -u ZendEngine2/zend_vm_opcodes.h:1.28 ZendEngine2/zend_vm_opcodes.h:1.29 --- ZendEngine2/zend_vm_opcodes.h:1.28 Thu Jun 16 08:26:44 2005 +++ ZendEngine2/zend_vm_opcodes.h Thu Jun 16 10:19:59 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_opcodes.h,v 1.28 2005/06/16 12:26:44 dmitry Exp $ */ +/* $Id: zend_vm_opcodes.h,v 1.29 2005/06/16 14:19:59 dmitry Exp $ */ #define ZEND_NOP 0 #define ZEND_ADD 1 http://cvs.php.net/co.php/ZendEngine2/tests/bug33318.phpt?r=1.1&p=1 Index: ZendEngine2/tests/bug33318.phpt +++ ZendEngine2/tests/bug33318.phpt --TEST-- Bug #33318 (throw 1; results in Invalid opcode 108/1/8) --FILE-- <?php throw 1; ?> --EXPECTF-- Fatal error: Can only throw objects in %sbug33318.php on line 2
« previous php.zend-engine.cvs (#3811) next »