mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Added support for __callstatic() magic method (missing part). (Sara)
This commit is contained in:
parent
b20ed0d2e0
commit
72d0454bf6
@ -351,6 +351,7 @@ struct _zend_class_entry {
|
||||
zend_object_value (*create_object)(zend_class_entry *class_type TSRMLS_DC);
|
||||
zend_object_iterator *(*get_iterator)(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
|
||||
int (*interface_gets_implemented)(zend_class_entry *iface, zend_class_entry *class_type TSRMLS_DC); /* a class implements this interface */
|
||||
union _zend_function *(*get_static_method)(zend_class_entry *ce, char* method, int method_len TSRMLS_DC);
|
||||
|
||||
/* serializer callbacks */
|
||||
int (*serialize)(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC);
|
||||
|
@ -138,6 +138,7 @@ typedef struct _zend_function_entry {
|
||||
class_container.unserialize = NULL; \
|
||||
class_container.create_object = NULL; \
|
||||
class_container.interface_gets_implemented = NULL; \
|
||||
class_container.get_static_method = NULL; \
|
||||
class_container.__call = handle_fcall; \
|
||||
class_container.__callstatic = handle_fcall; \
|
||||
class_container.__tostring = NULL; \
|
||||
|
@ -4491,6 +4491,7 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify
|
||||
ce->get_iterator = NULL;
|
||||
ce->iterator_funcs.funcs = NULL;
|
||||
ce->interface_gets_implemented = NULL;
|
||||
ce->get_static_method = NULL;
|
||||
ce->parent = NULL;
|
||||
ce->num_interfaces = 0;
|
||||
ce->interfaces = NULL;
|
||||
|
@ -835,8 +835,13 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
} else if (calling_scope) {
|
||||
char *function_name_lc = zend_str_tolower_dup(fname, fname_len);
|
||||
|
||||
EX(function_state).function =
|
||||
zend_std_get_static_method(calling_scope, function_name_lc, fname_len TSRMLS_CC);
|
||||
if (calling_scope->get_static_method) {
|
||||
EX(function_state).function =
|
||||
calling_scope->get_static_method(calling_scope, function_name_lc, fname_len TSRMLS_CC);
|
||||
} else {
|
||||
EX(function_state).function =
|
||||
zend_std_get_static_method(calling_scope, function_name_lc, fname_len TSRMLS_CC);
|
||||
}
|
||||
efree(function_name_lc);
|
||||
if (check_scope_or_static && EX(function_state).function
|
||||
&& !(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC)
|
||||
|
@ -1778,7 +1778,11 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
|
||||
function_name_strlen = function_name->value.str.len;
|
||||
}
|
||||
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
if (ce->get_static_method) {
|
||||
EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
} else {
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (!is_const) {
|
||||
efree(function_name_strval);
|
||||
|
@ -170,7 +170,6 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
|
||||
zend_ptr_stack_2_push(&EG(argument_stack), (void *)(zend_uintptr_t)opline->extended_value, NULL);
|
||||
|
||||
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
|
||||
// EX_T(opline->result.u.var).var.fcall_returned_reference = 0;
|
||||
|
||||
if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) {
|
||||
ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr);
|
||||
@ -2431,7 +2430,11 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HAN
|
||||
function_name_strlen = function_name->value.str.len;
|
||||
}
|
||||
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
if (ce->get_static_method) {
|
||||
EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
} else {
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (!is_const) {
|
||||
efree(function_name_strval);
|
||||
@ -2975,7 +2978,11 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDL
|
||||
function_name_strlen = function_name->value.str.len;
|
||||
}
|
||||
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
if (ce->get_static_method) {
|
||||
EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
} else {
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (!is_const) {
|
||||
efree(function_name_strval);
|
||||
@ -3419,7 +3426,11 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDL
|
||||
function_name_strlen = function_name->value.str.len;
|
||||
}
|
||||
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
if (ce->get_static_method) {
|
||||
EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
} else {
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (!is_const) {
|
||||
efree(function_name_strval);
|
||||
@ -3629,7 +3640,11 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HA
|
||||
function_name_strlen = function_name->value.str.len;
|
||||
}
|
||||
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
if (ce->get_static_method) {
|
||||
EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
} else {
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (!is_const) {
|
||||
efree(function_name_strval);
|
||||
@ -4041,7 +4056,11 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLE
|
||||
function_name_strlen = function_name->value.str.len;
|
||||
}
|
||||
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
if (ce->get_static_method) {
|
||||
EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
} else {
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (!is_const) {
|
||||
efree(function_name_strval);
|
||||
@ -9619,7 +9638,11 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDL
|
||||
function_name_strlen = function_name->value.str.len;
|
||||
}
|
||||
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
if (ce->get_static_method) {
|
||||
EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
} else {
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (!is_const) {
|
||||
efree(function_name_strval);
|
||||
@ -11260,7 +11283,11 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER
|
||||
function_name_strlen = function_name->value.str.len;
|
||||
}
|
||||
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
if (ce->get_static_method) {
|
||||
EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
} else {
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (!is_const) {
|
||||
efree(function_name_strval);
|
||||
@ -12873,7 +12900,11 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER
|
||||
function_name_strlen = function_name->value.str.len;
|
||||
}
|
||||
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
if (ce->get_static_method) {
|
||||
EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
} else {
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (!is_const) {
|
||||
efree(function_name_strval);
|
||||
@ -13687,7 +13718,11 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAND
|
||||
function_name_strlen = function_name->value.str.len;
|
||||
}
|
||||
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
if (ce->get_static_method) {
|
||||
EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
} else {
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (!is_const) {
|
||||
efree(function_name_strval);
|
||||
@ -15001,7 +15036,11 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_
|
||||
function_name_strlen = function_name->value.str.len;
|
||||
}
|
||||
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
if (ce->get_static_method) {
|
||||
EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
} else {
|
||||
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (!is_const) {
|
||||
efree(function_name_strval);
|
||||
|
Loading…
Reference in New Issue
Block a user