com php-src: Fix RECV opcode to handle all kinds of exceptions: Zend/tests/bug72057.phpt Zend/zend_vm_def.h Zend/zend _vm_execute.h

From: Date: Wed, 20 Apr 2016 08:56:07 +0000
Subject: com php-src: Fix RECV opcode to handle all kinds of exceptions: Zend/tests/bug72057.phpt Zend/zend_vm_def.h Zend/zend _vm_execute.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-91796@lists.php.net to get a copy of this message
Commit: ed9a1a9d68d91aea8be518d8e390ee28f3d18eee Author: Nikita Nefedov <inefedor@gmail.com> Tue, 19 Apr 2016 19:26:08 +0300 Committer: nikita2206 <inefedor@gmail.com> Wed, 20 Apr 2016 11:56:07 +0300 Parents: 7d93363bd9ea03c11bfbeea03645260506ef9a2e Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ed9a1a9d68d91aea8be518d8e390ee28f3d18eee Log: Fix RECV opcode to handle all kinds of exceptions fix RECV opcode to handle exceptions thrown from user-defined error handler as a result Notice error from failed type coercion Changed paths: A Zend/tests/bug72057.phpt M Zend/zend_vm_def.h M Zend/zend_vm_execute.h Diff: diff --git a/Zend/tests/bug72057.phpt b/Zend/tests/bug72057.phpt new file mode 100644 index 0000000..e1a129b --- /dev/null +++ b/Zend/tests/bug72057.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #72057 (PHP hangs when user error handler throws exception after Notice from type coercion) +--FILE-- +<?php + +set_error_handler( + function() { + throw new Exception("My custom error"); + } +); + +(function (int $i) { bar(); })("7as"); + +--EXPECTF-- + +Fatal error: Uncaught Exception: My custom error in %s:%d +Stack trace: +#0 %s(%d): {closure}(8, 'A non well form...', '%s', %d, Array) +#1 %s(%d): {closure}('7as') +#2 {main} + thrown in %s on line %d diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 1b1137d..687493f 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -4704,7 +4704,7 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY) zval *param = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->result.var); SAVE_OPLINE(); - if (UNEXPECTED(!zend_verify_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num)))) { + if (UNEXPECTED(!zend_verify_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num)) || EG(exception))) { HANDLE_EXCEPTION(); } } @@ -4742,7 +4742,7 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST) zval *default_value = EX_CONSTANT(opline->op2); SAVE_OPLINE(); - if (UNEXPECTED(!zend_verify_arg_type(EX(func), arg_num, param, default_value, CACHE_ADDR(Z_CACHE_SLOT_P(default_value))))) { + if (UNEXPECTED(!zend_verify_arg_type(EX(func), arg_num, param, default_value, CACHE_ADDR(Z_CACHE_SLOT_P(default_value))) || EG(exception))) { HANDLE_EXCEPTION(); } } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 98fa5e5..2746c40 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1188,7 +1188,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_ zval *param = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->result.var); SAVE_OPLINE(); - if (UNEXPECTED(!zend_verify_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num)))) { + if (UNEXPECTED(!zend_verify_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num)) || EG(exception))) { HANDLE_EXCEPTION(); } } @@ -2208,7 +2208,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_INIT_SPEC_CONST_HANDLER(Z zval *default_value = EX_CONSTANT(opline->op2); SAVE_OPLINE(); - if (UNEXPECTED(!zend_verify_arg_type(EX(func), arg_num, param, default_value, CACHE_ADDR(Z_CACHE_SLOT_P(default_value))))) { + if (UNEXPECTED(!zend_verify_arg_type(EX(func), arg_num, param, default_value, CACHE_ADDR(Z_CACHE_SLOT_P(default_value))) || EG(exception))) { HANDLE_EXCEPTION(); } }

« previous php.cvs (#91796) next »