cvs: ZendEngine2(PHP_5_2) / zend_compile.h zend_vm_def.h zend_vm_execute.h /tests bug38808.phpt php-src NEWS

From: Date: Tue, 26 Sep 2006 10:30:53 +0000
Subject: cvs: ZendEngine2(PHP_5_2) / zend_compile.h zend_vm_def.h zend_vm_execute.h /tests bug38808.phpt php-src NEWS
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-5271@lists.php.net to get a copy of this message
dmitry Tue Sep 26 10:30:53 2006 UTC Added files: (Branch: PHP_5_2) /ZendEngine2/tests bug38808.phpt Modified files: /php-src NEWS /ZendEngine2 zend_compile.h zend_vm_def.h zend_vm_execute.h Log: Fixed bug #38808 ("maybe ref" issue for current() and others) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.265&r2=1.2027.2.547.2.266&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.265 php-src/NEWS:1.2027.2.547.2.266 --- php-src/NEWS:1.2027.2.547.2.265 Tue Sep 26 07:55:08 2006 +++ php-src/NEWS Tue Sep 26 10:30:50 2006 @@ -13,6 +13,7 @@ - Fixed bug #38891 (get_headers() do not work with curl-wrappers). (Ilia) - Fixed bug #38844 (curl_easy_strerror() is defined only since cURL 7.12.0). (Tony) +- Fixed bug #38808 ("maybe ref" issue for current() and others). (Dmitry) - Fixed bug #38623 (leaks in a tricky code with switch() and exceptions). (Dmitry) - Fixed bug #38579 (include_once() may include the same file twice). (Dmitry) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.h?r1=1.316.2.8.2.6&r2=1.316.2.8.2.7&diff_format=u Index: ZendEngine2/zend_compile.h diff -u ZendEngine2/zend_compile.h:1.316.2.8.2.6 ZendEngine2/zend_compile.h:1.316.2.8.2.7 --- ZendEngine2/zend_compile.h:1.316.2.8.2.6 Tue Sep 19 21:36:53 2006 +++ ZendEngine2/zend_compile.h Tue Sep 26 10:30:50 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.h,v 1.316.2.8.2.6 2006/09/19 21:36:53 dmitry Exp $ */ +/* $Id: zend_compile.h,v 1.316.2.8.2.7 2006/09/26 10:30:50 dmitry Exp $ */ #ifndef ZEND_COMPILE_H #define ZEND_COMPILE_H @@ -663,40 +663,22 @@ #define ZEND_SEND_BY_REF 1 #define ZEND_SEND_PREFER_REF 2 -/* Lost In Stupid Parentheses */ -#define ARG_SHOULD_BE_SENT_BY_REF(zf, arg_num) \ - ( \ - zf \ - && ((zend_function *) zf)->common.arg_info \ - && \ - ( \ - ( \ - arg_num<=((zend_function *) zf)->common.num_args \ - && ((zend_function *) zf)->common.arg_info[arg_num-1].pass_by_reference == ZEND_SEND_BY_REF \ - ) \ - || ( \ - arg_num>((zend_function *) zf)->common.num_args \ - && ((zend_function *) zf)->common.pass_rest_by_reference == ZEND_SEND_BY_REF \ - ) \ - ) \ - ) - -#define ARG_MAY_BE_SENT_BY_REF(zf, arg_num) \ - ( \ - zf \ - && ((zend_function *) zf)->common.arg_info \ - && \ - ( \ - ( \ - arg_num<=((zend_function *) zf)->common.num_args \ - && ((zend_function *) zf)->common.arg_info[arg_num-1].pass_by_reference == ZEND_SEND_PREFER_REF \ - ) \ - || ( \ - arg_num>((zend_function *) zf)->common.num_args \ - && ((zend_function *) zf)->common.pass_rest_by_reference == ZEND_SEND_PREFER_REF \ - ) \ - ) \ - ) +#define ARG_SEND_TYPE(zf, arg_num) \ + ((zf) ? \ + ((((zend_function*)(zf))->common.arg_info && \ + arg_num<=((zend_function*)(zf))->common.num_args) ? \ + ((zend_function *)(zf))->common.arg_info[arg_num-1].pass_by_reference : \ + ((zend_function *)(zf))->common.pass_rest_by_reference) : \ + ZEND_SEND_BY_VAL) + +#define ARG_MUST_BE_SENT_BY_REF(zf, arg_num) \ + (ARG_SEND_TYPE(zf, arg_num) == ZEND_SEND_BY_REF) + +#define ARG_SHOULD_BE_SENT_BY_REF(zf, arg_num) \ + (ARG_SEND_TYPE(zf, arg_num) & (ZEND_SEND_BY_REF|ZEND_SEND_PREFER_REF)) + +#define ARG_MAY_BE_SENT_BY_REF(zf, arg_num) \ + (ARG_SEND_TYPE(zf, arg_num) == ZEND_SEND_PREFER_REF) #define ZEND_RETURN_VAL 0 #define ZEND_RETURN_REF 1 http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.59.2.29.2.28&r2=1.59.2.29.2.29&diff_format=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.59.2.29.2.28 ZendEngine2/zend_vm_def.h:1.59.2.29.2.29 --- ZendEngine2/zend_vm_def.h:1.59.2.29.2.28 Tue Sep 19 21:36:53 2006 +++ ZendEngine2/zend_vm_def.h Tue Sep 26 10:30:50 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.59.2.29.2.28 2006/09/19 21:36:53 dmitry Exp $ */ +/* $Id: zend_vm_def.h,v 1.59.2.29.2.29 2006/09/26 10:30:50 dmitry Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -2191,7 +2191,7 @@ { zend_op *opline = EX(opline); if (opline->extended_value==ZEND_DO_FCALL_BY_NAME - && ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) { + && ARG_MUST_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) { zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.u.opline_num); } { http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.62.2.30.2.28&r2=1.62.2.30.2.29&diff_format=u Index: ZendEngine2/zend_vm_execute.h diff -u ZendEngine2/zend_vm_execute.h:1.62.2.30.2.28 ZendEngine2/zend_vm_execute.h:1.62.2.30.2.29 --- ZendEngine2/zend_vm_execute.h:1.62.2.30.2.28 Tue Sep 19 21:36:53 2006 +++ ZendEngine2/zend_vm_execute.h Tue Sep 26 10:30:50 2006 @@ -1794,7 +1794,7 @@ { zend_op *opline = EX(opline); if (opline->extended_value==ZEND_DO_FCALL_BY_NAME - && ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) { + && ARG_MUST_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) { zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.u.opline_num); } { @@ -4320,7 +4320,7 @@ { zend_op *opline = EX(opline); if (opline->extended_value==ZEND_DO_FCALL_BY_NAME - && ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) { + && ARG_MUST_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) { zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.u.opline_num); } { @@ -7338,7 +7338,7 @@ { zend_op *opline = EX(opline); if (opline->extended_value==ZEND_DO_FCALL_BY_NAME - && ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) { + && ARG_MUST_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) { zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.u.opline_num); } { @@ -19377,7 +19377,7 @@ { zend_op *opline = EX(opline); if (opline->extended_value==ZEND_DO_FCALL_BY_NAME - && ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) { + && ARG_MUST_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) { zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.u.opline_num); } { http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug38808.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/bug38808.phpt +++ ZendEngine2/tests/bug38808.phpt

« previous php.zend-engine.cvs (#5271) next »