Don't check argument types for internal functions without type hinting

This commit is contained in:
Dmitry Stogov 2013-11-28 11:44:14 +04:00
parent fcb98cbce8
commit 57c1335fec
4 changed files with 18 additions and 2 deletions

View file

@ -2138,6 +2138,19 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
str_efree(lowercase_name);
break;
}
/* If types of arguments have to be checked */
if (reg_function->common.arg_info && reg_function->common.num_args) {
int i;
for (i = 0; i < reg_function->common.num_args; i++) {
if (reg_function->common.arg_info[i].class_name ||
reg_function->common.arg_info[i].type_hint) {
reg_function->common.fn_flags |= ZEND_ACC_HAS_TYPE_HINTS;
break;
}
}
}
if (scope) {
/* Look for ctor, dtor, clone
* If it's an old-style constructor, store it only if we don't have

View file

@ -212,6 +212,9 @@ typedef struct _zend_try_catch_element {
#define ZEND_ACC_RETURN_REFERENCE 0x4000000
#define ZEND_ACC_DONE_PASS_TWO 0x8000000
/* function has arguments with type hinting */
#define ZEND_ACC_HAS_TYPE_HINTS 0x10000000
char *zend_visibility_string(zend_uint fn_flags);

View file

@ -1951,7 +1951,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
LOAD_OPLINE();
if (fbc->type == ZEND_INTERNAL_FUNCTION) {
if (fbc->common.arg_info) {
if (fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) {
zend_uint i=0;
zval **p = (zval**)EX(function_state).arguments;
ulong arg_count = opline->extended_value;

View file

@ -530,7 +530,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
LOAD_OPLINE();
if (fbc->type == ZEND_INTERNAL_FUNCTION) {
if (fbc->common.arg_info) {
if (fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) {
zend_uint i=0;
zval **p = (zval**)EX(function_state).arguments;
ulong arg_count = opline->extended_value;