com php-src: Add consistency check in FAST_ZPP call So ensure Z_PARAM_OPTIONAL is correctly call at th e right place Only in DEBUG build: Zend/zend_
API.h
| From: | Remi Collet | Date: | Tue, 19 May 2015 08:54:10 +0000 |
| Subject: | com php-src: Add consistency check in FAST_ZPP call So ensure Z_PARAM_OPTIONAL is correctly call at th e right place Only in DEBUG build: Zend/zend_ API.h |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-86801@lists.php.net to get a copy of this message | ||
Commit: a861019b7fdef1d8feb2bea9d7cceedd7ce55b30
Author: Remi Collet <remi@php.net> Tue, 19 May 2015 10:54:10 +0200
Parents: b3d053b036e564e9bce6df705de8710823a43016
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a861019b7fdef1d8feb2bea9d7cceedd7ce55b30
Log:
Add consistency check in FAST_ZPP call
So ensure Z_PARAM_OPTIONAL is correctly call at the right place
Only in DEBUG build
Will raise 'Assertion `_i > _min_num_args || _optional==0' failed.'
or 'Assertion `_i <= _min_num_args || _optional==1' failed.'
Thus will allow to detect bad code early.
Changed paths:
M Zend/zend_API.h
Diff:
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index 1c1aafb..7de97ff 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -774,6 +774,8 @@ ZEND_API void ZEND_FASTCALL zend_wrong_callback_error(int severity, int num, cha
#define Z_PARAM_PROLOGUE(separate) \
++_i; \
+ ZEND_ASSERT(_i <= _min_num_args || _optional==1); \
+ ZEND_ASSERT(_i > _min_num_args || _optional==0); \
if (_optional) { \
if (UNEXPECTED(_i >_num_args)) break; \
} \
@@ -1011,6 +1013,8 @@ ZEND_API void ZEND_FASTCALL zend_wrong_callback_error(int severity, int num,
cha
zend_parse_arg_zval_deref(_arg, &dest, check_null); \
} else { \
++_i; \
+ ZEND_ASSERT(_i <= _min_num_args || _optional==1); \
+ ZEND_ASSERT(_i > _min_num_args || _optional==0); \
if (_optional && UNEXPECTED(_i >_num_args)) break; \
_real_arg++; \
zend_parse_arg_zval(_real_arg, &dest, check_null); \