mirror of
https://github.com/php/php-src.git
synced 2026-04-25 17:08:14 +02:00
- MFH some changes (from last fix on 5.3+)
- Constified method_name arg in zend_get_user_call_function()
This commit is contained in:
@@ -762,15 +762,15 @@ static inline zend_class_entry * zend_get_function_root_class(zend_function *fbc
|
||||
}
|
||||
|
||||
|
||||
static inline union _zend_function *zend_get_user_call_function(zend_object *zobj, char *method_name, int method_len) /* {{{ */
|
||||
static inline union _zend_function *zend_get_user_call_function(zend_class_entry *ce, const char *method_name, int method_len) /* {{{ */
|
||||
{
|
||||
zend_internal_function *call_user_call = emalloc(sizeof(zend_internal_function));
|
||||
call_user_call->type = ZEND_INTERNAL_FUNCTION;
|
||||
call_user_call->module = zobj->ce->module;
|
||||
call_user_call->module = ce->module;
|
||||
call_user_call->handler = zend_std_call_user_call;
|
||||
call_user_call->arg_info = NULL;
|
||||
call_user_call->num_args = 0;
|
||||
call_user_call->scope = zobj->ce;
|
||||
call_user_call->scope = ce;
|
||||
call_user_call->fn_flags = 0;
|
||||
call_user_call->function_name = estrndup(method_name, method_len);
|
||||
call_user_call->pass_rest_by_reference = 0;
|
||||
@@ -796,7 +796,7 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, char *method
|
||||
if (zend_hash_find(&zobj->ce->function_table, lc_method_name, method_len+1, (void **)&fbc) == FAILURE) {
|
||||
free_alloca_with_limit(lc_method_name, use_heap);
|
||||
if (zobj->ce->__call) {
|
||||
return zend_get_user_call_function(zobj, method_name, method_len);
|
||||
return zend_get_user_call_function(zobj->ce, method_name, method_len);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
@@ -814,7 +814,7 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, char *method
|
||||
fbc = updated_fbc;
|
||||
} else {
|
||||
if (zobj->ce->__call) {
|
||||
fbc = zend_get_user_call_function(zobj, method_name, method_len);
|
||||
fbc = zend_get_user_call_function(zobj->ce, method_name, method_len);
|
||||
} else {
|
||||
zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : "");
|
||||
}
|
||||
@@ -840,7 +840,7 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, char *method
|
||||
*/
|
||||
if (!zend_check_protected(zend_get_function_root_class(fbc), EG(scope))) {
|
||||
if (zobj->ce->__call) {
|
||||
fbc = zend_get_user_call_function(zobj, method_name, method_len);
|
||||
fbc = zend_get_user_call_function(zobj->ce, method_name, method_len);
|
||||
} else {
|
||||
zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : "");
|
||||
}
|
||||
@@ -868,20 +868,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *f
|
||||
EG(This) &&
|
||||
Z_OBJ_HT_P(EG(This))->get_class_entry &&
|
||||
instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
|
||||
zend_internal_function *call_user_call = emalloc(sizeof(zend_internal_function));
|
||||
|
||||
call_user_call->type = ZEND_INTERNAL_FUNCTION;
|
||||
call_user_call->module = ce->module;
|
||||
call_user_call->handler = zend_std_call_user_call;
|
||||
call_user_call->arg_info = NULL;
|
||||
call_user_call->num_args = 0;
|
||||
call_user_call->scope = ce;
|
||||
call_user_call->fn_flags = 0;
|
||||
call_user_call->function_name = estrndup(function_name_strval, function_name_strlen);
|
||||
call_user_call->pass_rest_by_reference = 0;
|
||||
call_user_call->return_reference = ZEND_RETURN_VALUE;
|
||||
|
||||
return (union _zend_function *)call_user_call;
|
||||
return zend_get_user_call_function(ce, function_name_strval, function_name_strlen);
|
||||
} else {
|
||||
char *class_name = ce->name;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user