mirror of
https://github.com/php/php-src.git
synced 2025-08-17 22:48:57 +02:00
Don't check argument types for internal functions without type hinting
This commit is contained in:
parent
fcb98cbce8
commit
57c1335fec
4 changed files with 18 additions and 2 deletions
|
@ -2138,6 +2138,19 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
|
||||||
str_efree(lowercase_name);
|
str_efree(lowercase_name);
|
||||||
break;
|
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) {
|
if (scope) {
|
||||||
/* Look for ctor, dtor, clone
|
/* Look for ctor, dtor, clone
|
||||||
* If it's an old-style constructor, store it only if we don't have
|
* If it's an old-style constructor, store it only if we don't have
|
||||||
|
|
|
@ -212,6 +212,9 @@ typedef struct _zend_try_catch_element {
|
||||||
#define ZEND_ACC_RETURN_REFERENCE 0x4000000
|
#define ZEND_ACC_RETURN_REFERENCE 0x4000000
|
||||||
#define ZEND_ACC_DONE_PASS_TWO 0x8000000
|
#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);
|
char *zend_visibility_string(zend_uint fn_flags);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1951,7 +1951,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
||||||
LOAD_OPLINE();
|
LOAD_OPLINE();
|
||||||
|
|
||||||
if (fbc->type == ZEND_INTERNAL_FUNCTION) {
|
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;
|
zend_uint i=0;
|
||||||
zval **p = (zval**)EX(function_state).arguments;
|
zval **p = (zval**)EX(function_state).arguments;
|
||||||
ulong arg_count = opline->extended_value;
|
ulong arg_count = opline->extended_value;
|
||||||
|
|
|
@ -530,7 +530,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
|
||||||
LOAD_OPLINE();
|
LOAD_OPLINE();
|
||||||
|
|
||||||
if (fbc->type == ZEND_INTERNAL_FUNCTION) {
|
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;
|
zend_uint i=0;
|
||||||
zval **p = (zval**)EX(function_state).arguments;
|
zval **p = (zval**)EX(function_state).arguments;
|
||||||
ulong arg_count = opline->extended_value;
|
ulong arg_count = opline->extended_value;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue