8000 Fix bug #40531 mb_substr optional parameters by mytskine · Pull Request #13 · php/php-src · GitHub
[go: up one dir, main page]

Skip to content

Fix bug #40531 mb_substr optional parameters #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Allow type check for IS_LONG in zend_verify_arg_type()
zend_verify_arg_type() only accepted to verify arg types as classes,
arrays or objects. Now it accepts integers. This is necessary to
check wether an argument is an integer or null, which can't be done
at a higher level like zend_parse_parameters(...,"l").
  • Loading branch information
François Gannaz committed Mar 20, 2012
commit a61c0e9dcd9b253bfff86ecf7949f526017940f6
11 changes: 11 additions & 0 deletions Zend/zend_execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,17 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
}
} else if (cur_arg_info->type_hint) {
switch(cur_arg_info->type_hint) {
case IS_LONG:
if (!arg) {
return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type long", "", "none", "" TSRMLS_CC);
}

if (Z_TYPE_P(arg) != IS_LONG && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)
&& (Z_TYPE_P(arg) != IS_STRING || is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), NULL, NULL, 0)) == 0) {
return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type long", "", zend_zval_type_name(arg), "" TSRMLS_CC);
}
break;

case IS_ARRAY:
if (!arg) {
return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", "none", "" TSRMLS_CC);
Expand Down
0