mirror of
https://github.com/php/php-src.git
synced 2025-08-20 09:24:05 +02:00
Fixed bug #46409 (__invoke method called outside of object context when using array_map)
This commit is contained in:
parent
496ec83e38
commit
e5454b359a
29 changed files with 147 additions and 134 deletions
25
Zend/tests/bug46409.phpt
Normal file
25
Zend/tests/bug46409.phpt
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #46409 (__invoke method called outside of object context when using array_map)
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
class Callback {
|
||||||
|
protected $val = 'hello, world';
|
||||||
|
|
||||||
|
public function __invoke() {
|
||||||
|
return $this->val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$cb = new Callback();
|
||||||
|
echo $cb(),"\n";
|
||||||
|
$a = array(1, 2);
|
||||||
|
$b = array_map($cb, $a);
|
||||||
|
print_r($b);
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
hello, world
|
||||||
|
Array
|
||||||
|
(
|
||||||
|
[0] => hello, world
|
||||||
|
[1] => hello, world
|
||||||
|
)
|
|
@ -2713,8 +2713,8 @@ static int zend_is_callable_check_class(zend_uchar utype, const zstr name, int n
|
||||||
} else {
|
} else {
|
||||||
fcc->called_scope = EG(called_scope);
|
fcc->called_scope = EG(called_scope);
|
||||||
fcc->calling_scope = EG(scope);
|
fcc->calling_scope = EG(scope);
|
||||||
if (!fcc->object_pp) {
|
if (!fcc->object_ptr) {
|
||||||
fcc->object_pp = EG(This) ? &EG(This) : NULL;
|
fcc->object_ptr = EG(This);
|
||||||
}
|
}
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
@ -2727,8 +2727,8 @@ static int zend_is_callable_check_class(zend_uchar utype, const zstr name, int n
|
||||||
} else {
|
} else {
|
||||||
fcc->called_scope = EG(called_scope);
|
fcc->called_scope = EG(called_scope);
|
||||||
fcc->calling_scope = EG(scope)->parent;
|
fcc->calling_scope = EG(scope)->parent;
|
||||||
if (!fcc->object_pp) {
|
if (!fcc->object_ptr) {
|
||||||
fcc->object_pp = EG(This) ? &EG(This) : NULL;
|
fcc->object_ptr = EG(This);
|
||||||
}
|
}
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
@ -2739,8 +2739,8 @@ static int zend_is_callable_check_class(zend_uchar utype, const zstr name, int n
|
||||||
} else {
|
} else {
|
||||||
fcc->called_scope = EG(called_scope);
|
fcc->called_scope = EG(called_scope);
|
||||||
fcc->calling_scope = EG(called_scope);
|
fcc->calling_scope = EG(called_scope);
|
||||||
if (!fcc->object_pp) {
|
if (!fcc->object_ptr) {
|
||||||
fcc->object_pp = EG(This) ? &EG(This) : NULL;
|
fcc->object_ptr = EG(This);
|
||||||
}
|
}
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
@ -2748,13 +2748,13 @@ static int zend_is_callable_check_class(zend_uchar utype, const zstr name, int n
|
||||||
zend_class_entry *scope = EG(active_op_array) ? EG(active_op_array)->scope : NULL;
|
zend_class_entry *scope = EG(active_op_array) ? EG(active_op_array)->scope : NULL;
|
||||||
|
|
||||||
fcc->calling_scope = *pce;
|
fcc->calling_scope = *pce;
|
||||||
if (scope && !fcc->object_pp && EG(This) &&
|
if (scope && !fcc->object_ptr && EG(This) &&
|
||||||
instanceof_function(Z_OBJCE_P(EG(This)), scope TSRMLS_CC) &&
|
instanceof_function(Z_OBJCE_P(EG(This)), scope TSRMLS_CC) &&
|
||||||
instanceof_function(scope, fcc->calling_scope TSRMLS_CC)) {
|
instanceof_function(scope, fcc->calling_scope TSRMLS_CC)) {
|
||||||
fcc->object_pp = &EG(This);
|
fcc->object_ptr = EG(This);
|
||||||
fcc->called_scope = Z_OBJCE_PP(fcc->object_pp);
|
fcc->called_scope = Z_OBJCE_P(fcc->object_ptr);
|
||||||
} else {
|
} else {
|
||||||
fcc->called_scope = fcc->object_pp ? Z_OBJCE_PP(fcc->object_pp) : fcc->calling_scope;
|
fcc->called_scope = fcc->object_ptr ? Z_OBJCE_P(fcc->object_ptr) : fcc->calling_scope;
|
||||||
}
|
}
|
||||||
ret = 1;
|
ret = 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2896,8 +2896,8 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
|
||||||
fcc->function_handler = priv_fbc;
|
fcc->function_handler = priv_fbc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (fcc->object_pp) {
|
} else if (fcc->object_ptr) {
|
||||||
if (Z_OBJ_HT_PP(fcc->object_pp)->get_method) {
|
if (Z_OBJ_HT_P(fcc->object_ptr)->get_method) {
|
||||||
zstr method = mname;
|
zstr method = mname;
|
||||||
int method_len = mlen;
|
int method_len = mlen;
|
||||||
|
|
||||||
|
@ -2906,7 +2906,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
|
||||||
} else if (!UG(unicode) && Z_TYPE_P(callable) == IS_UNICODE) {
|
} else if (!UG(unicode) && Z_TYPE_P(callable) == IS_UNICODE) {
|
||||||
zend_unicode_to_string(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &method.s, &method_len, mname.u, mlen TSRMLS_CC);
|
zend_unicode_to_string(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &method.s, &method_len, mname.u, mlen TSRMLS_CC);
|
||||||
}
|
}
|
||||||
fcc->function_handler = Z_OBJ_HT_PP(fcc->object_pp)->get_method(fcc->object_pp, method, method_len TSRMLS_CC);
|
fcc->function_handler = Z_OBJ_HT_P(fcc->object_ptr)->get_method(&fcc->object_ptr, method, method_len TSRMLS_CC);
|
||||||
if (method.v != mname.v) {
|
if (method.v != mname.v) {
|
||||||
efree(method.v);
|
efree(method.v);
|
||||||
}
|
}
|
||||||
|
@ -2925,7 +2925,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
|
||||||
|
|
||||||
if (retval) {
|
if (retval) {
|
||||||
if (fcc->calling_scope && !call_via_handler) {
|
if (fcc->calling_scope && !call_via_handler) {
|
||||||
if (!fcc->object_pp && !(fcc->function_handler->common.fn_flags & ZEND_ACC_STATIC)) {
|
if (!fcc->object_ptr && !(fcc->function_handler->common.fn_flags & ZEND_ACC_STATIC)) {
|
||||||
int severity;
|
int severity;
|
||||||
char *verb;
|
char *verb;
|
||||||
if (fcc->function_handler->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
|
if (fcc->function_handler->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
|
||||||
|
@ -2940,7 +2940,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
|
||||||
retval = 0;
|
retval = 0;
|
||||||
}
|
}
|
||||||
if (EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), fcc->calling_scope TSRMLS_CC)) {
|
if (EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), fcc->calling_scope TSRMLS_CC)) {
|
||||||
fcc->object_pp = &EG(This);
|
fcc->object_ptr = EG(This);
|
||||||
if (error) {
|
if (error) {
|
||||||
zend_spprintf(error, 0, "non-static method %v::%v() %s be called statically, assuming $this from compatible context %v", fcc->calling_scope->name, fcc->function_handler->common.function_name, verb, Z_OBJCE_P(EG(This))->name);
|
zend_spprintf(error, 0, "non-static method %v::%v() %s be called statically, assuming $this from compatible context %v", fcc->calling_scope->name, fcc->function_handler->common.function_name, verb, Z_OBJCE_P(EG(This))->name);
|
||||||
} else if (retval) {
|
} else if (retval) {
|
||||||
|
@ -2956,7 +2956,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
|
||||||
}
|
}
|
||||||
if (retval && (check_flags & IS_CALLABLE_CHECK_NO_ACCESS) == 0) {
|
if (retval && (check_flags & IS_CALLABLE_CHECK_NO_ACCESS) == 0) {
|
||||||
if (fcc->function_handler->op_array.fn_flags & ZEND_ACC_PRIVATE) {
|
if (fcc->function_handler->op_array.fn_flags & ZEND_ACC_PRIVATE) {
|
||||||
if (!zend_check_private(fcc->function_handler, fcc->object_pp ? Z_OBJCE_PP(fcc->object_pp) : EG(scope), lmname, lmlen TSRMLS_CC)) {
|
if (!zend_check_private(fcc->function_handler, fcc->object_ptr ? Z_OBJCE_P(fcc->object_ptr) : EG(scope), lmname, lmlen TSRMLS_CC)) {
|
||||||
if (error) {
|
if (error) {
|
||||||
if (*error) {
|
if (*error) {
|
||||||
efree(*error);
|
efree(*error);
|
||||||
|
@ -2987,8 +2987,8 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
|
||||||
}
|
}
|
||||||
efree(lmname.v);
|
efree(lmname.v);
|
||||||
|
|
||||||
if (fcc->object_pp) {
|
if (fcc->object_ptr) {
|
||||||
fcc->called_scope = Z_OBJCE_PP(fcc->object_pp);
|
fcc->called_scope = Z_OBJCE_P(fcc->object_ptr);
|
||||||
}
|
}
|
||||||
if (retval) {
|
if (retval) {
|
||||||
fcc->initialized = 1;
|
fcc->initialized = 1;
|
||||||
|
@ -2997,7 +2997,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval **object_pp, uint check_flags, zval *callable_name, zend_fcall_info_cache *fcc, char **error TSRMLS_DC) /* {{{ */
|
ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint check_flags, zval *callable_name, zend_fcall_info_cache *fcc, char **error TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
zend_bool ret;
|
zend_bool ret;
|
||||||
zend_fcall_info_cache fcc_local;
|
zend_fcall_info_cache fcc_local;
|
||||||
|
@ -3017,23 +3017,23 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval **object_pp, uint ch
|
||||||
fcc->called_scope = NULL;
|
fcc->called_scope = NULL;
|
||||||
fcc->function_handler = NULL;
|
fcc->function_handler = NULL;
|
||||||
fcc->calling_scope = NULL;
|
fcc->calling_scope = NULL;
|
||||||
fcc->object_pp = NULL;
|
fcc->object_ptr = NULL;
|
||||||
|
|
||||||
if (object_pp && (!*object_pp || Z_TYPE_PP(object_pp) != IS_OBJECT)) {
|
if (object_ptr && Z_TYPE_P(object_ptr) != IS_OBJECT) {
|
||||||
object_pp = NULL;
|
object_ptr = NULL;
|
||||||
}
|
}
|
||||||
if (object_pp && Z_TYPE_PP(object_pp) == IS_OBJECT &&
|
if (object_ptr && Z_TYPE_P(object_ptr) == IS_OBJECT &&
|
||||||
(!EG(objects_store).object_buckets ||
|
(!EG(objects_store).object_buckets ||
|
||||||
!EG(objects_store).object_buckets[Z_OBJ_HANDLE_PP(object_pp)].valid)) {
|
!EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(object_ptr)].valid)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Z_TYPE_P(callable)) {
|
switch (Z_TYPE_P(callable)) {
|
||||||
case IS_STRING:
|
case IS_STRING:
|
||||||
case IS_UNICODE:
|
case IS_UNICODE:
|
||||||
if (object_pp && *object_pp) {
|
if (object_ptr) {
|
||||||
fcc->object_pp = object_pp;
|
fcc->object_ptr = object_ptr;
|
||||||
fcc->calling_scope = Z_OBJCE_PP(object_pp);
|
fcc->calling_scope = Z_OBJCE_P(object_ptr);
|
||||||
if (callable_name) {
|
if (callable_name) {
|
||||||
if (UG(unicode)) {
|
if (UG(unicode)) {
|
||||||
Z_TYPE_P(callable_name) = IS_UNICODE;
|
Z_TYPE_P(callable_name) = IS_UNICODE;
|
||||||
|
@ -3183,7 +3183,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval **object_pp, uint ch
|
||||||
|
|
||||||
fcc->calling_scope = Z_OBJCE_PP(obj); /* TBFixed: what if it's overloaded? */
|
fcc->calling_scope = Z_OBJCE_PP(obj); /* TBFixed: what if it's overloaded? */
|
||||||
|
|
||||||
fcc->object_pp = obj;
|
fcc->object_ptr = *obj;
|
||||||
|
|
||||||
if (callable_name) {
|
if (callable_name) {
|
||||||
if (UG(unicode)) {
|
if (UG(unicode)) {
|
||||||
|
@ -3261,7 +3261,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval **object_pp, uint ch
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case IS_OBJECT:
|
case IS_OBJECT:
|
||||||
if (Z_OBJ_HANDLER_P(callable, get_closure) && Z_OBJ_HANDLER_P(callable, get_closure)(callable, &fcc->calling_scope, &fcc->function_handler, NULL, &fcc->object_pp TSRMLS_CC) == SUCCESS) {
|
if (Z_OBJ_HANDLER_P(callable, get_closure) && Z_OBJ_HANDLER_P(callable, get_closure)(callable, &fcc->calling_scope, &fcc->function_handler, &fcc->object_ptr TSRMLS_CC) == SUCCESS) {
|
||||||
fcc->called_scope = fcc->calling_scope;
|
fcc->called_scope = fcc->calling_scope;
|
||||||
if (callable_name) {
|
if (callable_name) {
|
||||||
zend_class_entry *ce = Z_OBJCE_P(callable); /* TBFixed: what if it's overloaded? */
|
zend_class_entry *ce = Z_OBJCE_P(callable); /* TBFixed: what if it's overloaded? */
|
||||||
|
@ -3340,7 +3340,7 @@ ZEND_API int zend_fcall_info_init(zval *callable, uint check_flags, zend_fcall_i
|
||||||
|
|
||||||
fci->size = sizeof(*fci);
|
fci->size = sizeof(*fci);
|
||||||
fci->function_table = fcc->calling_scope ? &fcc->calling_scope->function_table : EG(function_table);
|
fci->function_table = fcc->calling_scope ? &fcc->calling_scope->function_table : EG(function_table);
|
||||||
fci->object_pp = fcc->object_pp;
|
fci->object_ptr = fcc->object_ptr;
|
||||||
fci->function_name = callable;
|
fci->function_name = callable;
|
||||||
fci->retval_ptr_ptr = NULL;
|
fci->retval_ptr_ptr = NULL;
|
||||||
fci->param_count = 0;
|
fci->param_count = 0;
|
||||||
|
|
|
@ -48,7 +48,7 @@ typedef struct _zend_fcall_info {
|
||||||
zval **retval_ptr_ptr;
|
zval **retval_ptr_ptr;
|
||||||
zend_uint param_count;
|
zend_uint param_count;
|
||||||
zval ***params;
|
zval ***params;
|
||||||
zval **object_pp;
|
zval *object_ptr;
|
||||||
zend_bool no_separation;
|
zend_bool no_separation;
|
||||||
} zend_fcall_info;
|
} zend_fcall_info;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ typedef struct _zend_fcall_info_cache {
|
||||||
zend_function *function_handler;
|
zend_function *function_handler;
|
||||||
zend_class_entry *calling_scope;
|
zend_class_entry *calling_scope;
|
||||||
zend_class_entry *called_scope;
|
zend_class_entry *called_scope;
|
||||||
zval **object_pp;
|
zval *object_ptr;
|
||||||
} zend_fcall_info_cache;
|
} zend_fcall_info_cache;
|
||||||
|
|
||||||
#define ZEND_NS_NAME(ns, name) ns"::"name
|
#define ZEND_NS_NAME(ns, name) ns"::"name
|
||||||
|
@ -284,7 +284,7 @@ ZEND_API void zend_wrong_param_count(TSRMLS_D);
|
||||||
|
|
||||||
#define IS_CALLABLE_STRICT (IS_CALLABLE_CHECK_IS_STATIC)
|
#define IS_CALLABLE_STRICT (IS_CALLABLE_CHECK_IS_STATIC)
|
||||||
|
|
||||||
ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval **object_pp, uint check_flags, zval *callable_name, zend_fcall_info_cache *fcc, char **error TSRMLS_DC);
|
ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint check_flags, zval *callable_name, zend_fcall_info_cache *fcc, char **error TSRMLS_DC);
|
||||||
ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, zval *callable_name TSRMLS_DC);
|
ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, zval *callable_name TSRMLS_DC);
|
||||||
ZEND_API zend_bool zend_make_callable(zval *callable, zval *callable_name TSRMLS_DC);
|
ZEND_API zend_bool zend_make_callable(zval *callable, zval *callable_name TSRMLS_DC);
|
||||||
ZEND_API const char *zend_get_module_version(const char *module_name);
|
ZEND_API const char *zend_get_module_version(const char *module_name);
|
||||||
|
|
|
@ -213,7 +213,7 @@ static zend_object_value zend_closure_new(zend_class_entry *class_type TSRMLS_DC
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
int zend_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval **zobj_ptr, zval ***zobj_ptr_ptr TSRMLS_DC) /* {{{ */
|
int zend_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval **zobj_ptr TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
zend_closure *closure;
|
zend_closure *closure;
|
||||||
|
|
||||||
|
@ -228,17 +228,11 @@ int zend_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function
|
||||||
if (zobj_ptr) {
|
if (zobj_ptr) {
|
||||||
*zobj_ptr = closure->this_ptr;
|
*zobj_ptr = closure->this_ptr;
|
||||||
}
|
}
|
||||||
if (zobj_ptr_ptr) {
|
|
||||||
*zobj_ptr_ptr = &closure->this_ptr;
|
|
||||||
}
|
|
||||||
*ce_ptr = Z_OBJCE_P(closure->this_ptr);
|
*ce_ptr = Z_OBJCE_P(closure->this_ptr);
|
||||||
} else {
|
} else {
|
||||||
if (zobj_ptr) {
|
if (zobj_ptr) {
|
||||||
*zobj_ptr = NULL;
|
*zobj_ptr = NULL;
|
||||||
}
|
}
|
||||||
if (zobj_ptr_ptr) {
|
|
||||||
*zobj_ptr_ptr = NULL;
|
|
||||||
}
|
|
||||||
*ce_ptr = closure->func.common.scope;
|
*ce_ptr = closure->func.common.scope;
|
||||||
}
|
}
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
|
|
@ -31,7 +31,7 @@ void zend_register_closure_ce(TSRMLS_D);
|
||||||
extern ZEND_API zend_class_entry *zend_ce_closure;
|
extern ZEND_API zend_class_entry *zend_ce_closure;
|
||||||
|
|
||||||
ZEND_API void zend_create_closure(zval *res, zend_function *op_array, zend_class_entry *scope, zval *this_ptr TSRMLS_DC);
|
ZEND_API void zend_create_closure(zval *res, zend_function *op_array, zend_class_entry *scope, zval *this_ptr TSRMLS_DC);
|
||||||
ZEND_API int zend_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval **zobj_ptr, zval ***zobj_ptr_ptr TSRMLS_DC);
|
ZEND_API int zend_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval **zobj_ptr TSRMLS_DC);
|
||||||
ZEND_API zend_function *zend_get_closure_invoke_method(zval *obj TSRMLS_DC);
|
ZEND_API zend_function *zend_get_closure_invoke_method(zval *obj TSRMLS_DC);
|
||||||
|
|
||||||
END_EXTERN_C()
|
END_EXTERN_C()
|
||||||
|
|
|
@ -629,7 +629,7 @@ ZEND_METHOD(exception, __toString)
|
||||||
fci.function_table = &Z_OBJCE_P(getThis())->function_table;
|
fci.function_table = &Z_OBJCE_P(getThis())->function_table;
|
||||||
fci.function_name = &fname;
|
fci.function_name = &fname;
|
||||||
fci.symbol_table = NULL;
|
fci.symbol_table = NULL;
|
||||||
fci.object_pp = &exception;
|
fci.object_ptr = exception;
|
||||||
fci.retval_ptr_ptr = &trace;
|
fci.retval_ptr_ptr = &trace;
|
||||||
fci.param_count = 0;
|
fci.param_count = 0;
|
||||||
fci.params = NULL;
|
fci.params = NULL;
|
||||||
|
|
|
@ -726,7 +726,7 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
|
||||||
|
|
||||||
fci.size = sizeof(fci);
|
fci.size = sizeof(fci);
|
||||||
fci.function_table = function_table;
|
fci.function_table = function_table;
|
||||||
fci.object_pp = object_pp;
|
fci.object_ptr = object_pp ? *object_pp : NULL;
|
||||||
fci.function_name = function_name;
|
fci.function_name = function_name;
|
||||||
fci.retval_ptr_ptr = retval_ptr_ptr;
|
fci.retval_ptr_ptr = retval_ptr_ptr;
|
||||||
fci.param_count = param_count;
|
fci.param_count = param_count;
|
||||||
|
@ -794,7 +794,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||||
fci_cache = &fci_cache_local;
|
fci_cache = &fci_cache_local;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!zend_is_callable_ex(fci->function_name, fci->object_pp, IS_CALLABLE_CHECK_SILENT, &callable_name, fci_cache, &error TSRMLS_CC)) {
|
if (!zend_is_callable_ex(fci->function_name, fci->object_ptr, IS_CALLABLE_CHECK_SILENT, &callable_name, fci_cache, &error TSRMLS_CC)) {
|
||||||
if (error) {
|
if (error) {
|
||||||
zend_error(E_WARNING, "Invalid callback %Z, %s", callable_name, error);
|
zend_error(E_WARNING, "Invalid callback %Z, %s", callable_name, error);
|
||||||
efree(error);
|
efree(error);
|
||||||
|
@ -815,10 +815,10 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||||
EX(function_state).function = fci_cache->function_handler;
|
EX(function_state).function = fci_cache->function_handler;
|
||||||
calling_scope = fci_cache->calling_scope;
|
calling_scope = fci_cache->calling_scope;
|
||||||
called_scope = fci_cache->called_scope;
|
called_scope = fci_cache->called_scope;
|
||||||
fci->object_pp = fci_cache->object_pp;
|
fci->object_ptr = fci_cache->object_ptr;
|
||||||
EX(object) = fci->object_pp ? *fci->object_pp : NULL;
|
EX(object) = fci->object_ptr;
|
||||||
if (fci->object_pp && *fci->object_pp && Z_TYPE_PP(fci->object_pp) == IS_OBJECT
|
if (fci->object_ptr && Z_TYPE_P(fci->object_ptr) == IS_OBJECT
|
||||||
&& (!EG(objects_store).object_buckets || !EG(objects_store).object_buckets[Z_OBJ_HANDLE_PP(fci->object_pp)].valid)) {
|
&& (!EG(objects_store).object_buckets || !EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(fci->object_ptr)].valid)) {
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -899,11 +899,11 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||||
EG(called_scope) = NULL;
|
EG(called_scope) = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fci->object_pp) {
|
if (fci->object_ptr) {
|
||||||
if ((EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC)) {
|
if ((EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC)) {
|
||||||
EG(This) = NULL;
|
EG(This) = NULL;
|
||||||
} else {
|
} else {
|
||||||
EG(This) = *fci->object_pp;
|
EG(This) = fci->object_ptr;
|
||||||
|
|
||||||
if (!PZVAL_IS_REF(EG(This))) {
|
if (!PZVAL_IS_REF(EG(This))) {
|
||||||
Z_ADDREF_P(EG(This)); /* For $this pointer */
|
Z_ADDREF_P(EG(This)); /* For $this pointer */
|
||||||
|
@ -960,7 +960,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||||
if (EX(function_state).function->common.scope) {
|
if (EX(function_state).function->common.scope) {
|
||||||
EG(scope) = EX(function_state).function->common.scope;
|
EG(scope) = EX(function_state).function->common.scope;
|
||||||
}
|
}
|
||||||
((zend_internal_function *) EX(function_state).function)->handler(fci->param_count, *fci->retval_ptr_ptr, fci->retval_ptr_ptr, (fci->object_pp?*fci->object_pp:NULL), 1 TSRMLS_CC);
|
((zend_internal_function *) EX(function_state).function)->handler(fci->param_count, *fci->retval_ptr_ptr, fci->retval_ptr_ptr, fci->object_ptr, 1 TSRMLS_CC);
|
||||||
/* We shouldn't fix bad extensions here,
|
/* We shouldn't fix bad extensions here,
|
||||||
because it can break proper ones (Bug #34045)
|
because it can break proper ones (Bug #34045)
|
||||||
if (!EX(function_state).function->common.return_reference)
|
if (!EX(function_state).function->common.return_reference)
|
||||||
|
@ -980,8 +980,8 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||||
ALLOC_INIT_ZVAL(*fci->retval_ptr_ptr);
|
ALLOC_INIT_ZVAL(*fci->retval_ptr_ptr);
|
||||||
|
|
||||||
/* Not sure what should be done here if it's a static method */
|
/* Not sure what should be done here if it's a static method */
|
||||||
if (fci->object_pp) {
|
if (fci->object_ptr) {
|
||||||
Z_OBJ_HT_PP(fci->object_pp)->call_method(EX(function_state).function->common.function_name, fci->param_count, *fci->retval_ptr_ptr, fci->retval_ptr_ptr, *fci->object_pp, 1 TSRMLS_CC);
|
Z_OBJ_HT_P(fci->object_ptr)->call_method(EX(function_state).function->common.function_name, fci->param_count, *fci->retval_ptr_ptr, fci->retval_ptr_ptr, fci->object_ptr, 1 TSRMLS_CC);
|
||||||
} else {
|
} else {
|
||||||
zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object");
|
zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object");
|
||||||
}
|
}
|
||||||
|
@ -1101,14 +1101,14 @@ ZEND_API int zend_u_lookup_class_ex(zend_uchar type, zstr name, int name_length,
|
||||||
fcall_info.retval_ptr_ptr = &retval_ptr;
|
fcall_info.retval_ptr_ptr = &retval_ptr;
|
||||||
fcall_info.param_count = 1;
|
fcall_info.param_count = 1;
|
||||||
fcall_info.params = args;
|
fcall_info.params = args;
|
||||||
fcall_info.object_pp = NULL;
|
fcall_info.object_ptr = NULL;
|
||||||
fcall_info.no_separation = 1;
|
fcall_info.no_separation = 1;
|
||||||
|
|
||||||
fcall_cache.initialized = EG(autoload_func) ? 1 : 0;
|
fcall_cache.initialized = EG(autoload_func) ? 1 : 0;
|
||||||
fcall_cache.function_handler = EG(autoload_func);
|
fcall_cache.function_handler = EG(autoload_func);
|
||||||
fcall_cache.calling_scope = NULL;
|
fcall_cache.calling_scope = NULL;
|
||||||
fcall_cache.called_scope = NULL;
|
fcall_cache.called_scope = NULL;
|
||||||
fcall_cache.object_pp = NULL;
|
fcall_cache.object_ptr = NULL;
|
||||||
|
|
||||||
zend_exception_save(TSRMLS_C);
|
zend_exception_save(TSRMLS_C);
|
||||||
retval = zend_call_function(&fcall_info, &fcall_cache TSRMLS_CC);
|
retval = zend_call_function(&fcall_info, &fcall_cache TSRMLS_CC);
|
||||||
|
|
|
@ -46,7 +46,7 @@ ZEND_API zval* zend_u_call_method(zval **object_pp, zend_class_entry *obj_ce, ze
|
||||||
|
|
||||||
fci.size = sizeof(fci);
|
fci.size = sizeof(fci);
|
||||||
/*fci.function_table = NULL; will be read form zend_class_entry of object if needed */
|
/*fci.function_table = NULL; will be read form zend_class_entry of object if needed */
|
||||||
fci.object_pp = object_pp;
|
fci.object_ptr = object_pp ? *object_pp : NULL;
|
||||||
fci.function_name = &z_fname;
|
fci.function_name = &z_fname;
|
||||||
fci.retval_ptr_ptr = retval_ptr_ptr ? retval_ptr_ptr : &retval;
|
fci.retval_ptr_ptr = retval_ptr_ptr ? retval_ptr_ptr : &retval;
|
||||||
fci.param_count = param_count;
|
fci.param_count = param_count;
|
||||||
|
@ -86,7 +86,7 @@ ZEND_API zval* zend_u_call_method(zval **object_pp, zend_class_entry *obj_ce, ze
|
||||||
}
|
}
|
||||||
fcic.calling_scope = obj_ce;
|
fcic.calling_scope = obj_ce;
|
||||||
fcic.called_scope = object_pp ? obj_ce : EG(called_scope);
|
fcic.called_scope = object_pp ? obj_ce : EG(called_scope);
|
||||||
fcic.object_pp = object_pp;
|
fcic.object_ptr = object_pp ? *object_pp : NULL;
|
||||||
result = zend_call_function(&fci, &fcic TSRMLS_CC);
|
result = zend_call_function(&fci, &fcic TSRMLS_CC);
|
||||||
}
|
}
|
||||||
if (result == FAILURE) {
|
if (result == FAILURE) {
|
||||||
|
|
|
@ -1318,7 +1318,7 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
int zend_std_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval **zobj_ptr, zval ***zobj_ptr_ptr TSRMLS_DC) /* {{{ */
|
int zend_std_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval **zobj_ptr TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
zstr key;
|
zstr key;
|
||||||
zend_uchar utype = UG(unicode)?IS_UNICODE:IS_STRING;
|
zend_uchar utype = UG(unicode)?IS_UNICODE:IS_STRING;
|
||||||
|
@ -1348,16 +1348,10 @@ int zend_std_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **f
|
||||||
if (zobj_ptr) {
|
if (zobj_ptr) {
|
||||||
*zobj_ptr = NULL;
|
*zobj_ptr = NULL;
|
||||||
}
|
}
|
||||||
if (zobj_ptr_ptr) {
|
|
||||||
*zobj_ptr_ptr = NULL;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (zobj_ptr) {
|
if (zobj_ptr) {
|
||||||
*zobj_ptr = obj;
|
*zobj_ptr = obj;
|
||||||
}
|
}
|
||||||
if (zobj_ptr_ptr) {
|
|
||||||
*zobj_ptr_ptr = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (utype == IS_UNICODE) {
|
if (utype == IS_UNICODE) {
|
||||||
|
|
|
@ -108,7 +108,7 @@ typedef int (*zend_object_cast_t)(zval *readobj, zval *retval, int type, void *e
|
||||||
* Returns FAILURE if the object does not have any sense of overloaded dimensions */
|
* Returns FAILURE if the object does not have any sense of overloaded dimensions */
|
||||||
typedef int (*zend_object_count_elements_t)(zval *object, long *count TSRMLS_DC);
|
typedef int (*zend_object_count_elements_t)(zval *object, long *count TSRMLS_DC);
|
||||||
|
|
||||||
typedef int (*zend_object_get_closure_t)(zval *obj, zend_class_entry **ce_ptr, union _zend_function **fptr_ptr, zval **zobj_ptr, zval ***zobj_ptr_ptr TSRMLS_DC);
|
typedef int (*zend_object_get_closure_t)(zval *obj, zend_class_entry **ce_ptr, union _zend_function **fptr_ptr, zval **zobj_ptr TSRMLS_DC);
|
||||||
|
|
||||||
struct _zend_object_handlers {
|
struct _zend_object_handlers {
|
||||||
/* general object functions */
|
/* general object functions */
|
||||||
|
|
|
@ -2132,7 +2132,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
|
||||||
|
|
||||||
if (Z_TYPE_P(function_name) == IS_OBJECT &&
|
if (Z_TYPE_P(function_name) == IS_OBJECT &&
|
||||||
Z_OBJ_HANDLER_P(function_name, get_closure) &&
|
Z_OBJ_HANDLER_P(function_name, get_closure) &&
|
||||||
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &EX(called_scope), &EX(fbc), &EX(object), NULL TSRMLS_CC) == SUCCESS) {
|
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &EX(called_scope), &EX(fbc), &EX(object) TSRMLS_CC) == SUCCESS) {
|
||||||
if (EX(object)) {
|
if (EX(object)) {
|
||||||
Z_ADDREF_P(EX(object));
|
Z_ADDREF_P(EX(object));
|
||||||
}
|
}
|
||||||
|
|
|
@ -758,7 +758,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE
|
||||||
|
|
||||||
if (Z_TYPE_P(function_name) == IS_OBJECT &&
|
if (Z_TYPE_P(function_name) == IS_OBJECT &&
|
||||||
Z_OBJ_HANDLER_P(function_name, get_closure) &&
|
Z_OBJ_HANDLER_P(function_name, get_closure) &&
|
||||||
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &EX(called_scope), &EX(fbc), &EX(object), NULL TSRMLS_CC) == SUCCESS) {
|
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &EX(called_scope), &EX(fbc), &EX(object) TSRMLS_CC) == SUCCESS) {
|
||||||
if (EX(object)) {
|
if (EX(object)) {
|
||||||
Z_ADDREF_P(EX(object));
|
Z_ADDREF_P(EX(object));
|
||||||
}
|
}
|
||||||
|
@ -958,7 +958,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H
|
||||||
|
|
||||||
if (Z_TYPE_P(function_name) == IS_OBJECT &&
|
if (Z_TYPE_P(function_name) == IS_OBJECT &&
|
||||||
Z_OBJ_HANDLER_P(function_name, get_closure) &&
|
Z_OBJ_HANDLER_P(function_name, get_closure) &&
|
||||||
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &EX(called_scope), &EX(fbc), &EX(object), NULL TSRMLS_CC) == SUCCESS) {
|
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &EX(called_scope), &EX(fbc), &EX(object) TSRMLS_CC) == SUCCESS) {
|
||||||
if (EX(object)) {
|
if (EX(object)) {
|
||||||
Z_ADDREF_P(EX(object));
|
Z_ADDREF_P(EX(object));
|
||||||
}
|
}
|
||||||
|
@ -1046,7 +1046,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H
|
||||||
|
|
||||||
if (Z_TYPE_P(function_name) == IS_OBJECT &&
|
if (Z_TYPE_P(function_name) == IS_OBJECT &&
|
||||||
Z_OBJ_HANDLER_P(function_name, get_closure) &&
|
Z_OBJ_HANDLER_P(function_name, get_closure) &&
|
||||||
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &EX(called_scope), &EX(fbc), &EX(object), NULL TSRMLS_CC) == SUCCESS) {
|
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &EX(called_scope), &EX(fbc), &EX(object) TSRMLS_CC) == SUCCESS) {
|
||||||
if (EX(object)) {
|
if (EX(object)) {
|
||||||
Z_ADDREF_P(EX(object));
|
Z_ADDREF_P(EX(object));
|
||||||
}
|
}
|
||||||
|
@ -1163,7 +1163,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA
|
||||||
|
|
||||||
if (Z_TYPE_P(function_name) == IS_OBJECT &&
|
if (Z_TYPE_P(function_name) == IS_OBJECT &&
|
||||||
Z_OBJ_HANDLER_P(function_name, get_closure) &&
|
Z_OBJ_HANDLER_P(function_name, get_closure) &&
|
||||||
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &EX(called_scope), &EX(fbc), &EX(object), NULL TSRMLS_CC) == SUCCESS) {
|
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &EX(called_scope), &EX(fbc), &EX(object) TSRMLS_CC) == SUCCESS) {
|
||||||
if (EX(object)) {
|
if (EX(object)) {
|
||||||
Z_ADDREF_P(EX(object));
|
Z_ADDREF_P(EX(object));
|
||||||
}
|
}
|
||||||
|
|
|
@ -851,7 +851,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
|
||||||
|
|
||||||
fci.size = sizeof(fci);
|
fci.size = sizeof(fci);
|
||||||
fci.function_table = EG(function_table);
|
fci.function_table = EG(function_table);
|
||||||
fci.object_pp = NULL;
|
fci.object_ptr = NULL;
|
||||||
fci.function_name = t->func_name;
|
fci.function_name = t->func_name;
|
||||||
fci.retval_ptr_ptr = &retval_ptr;
|
fci.retval_ptr_ptr = &retval_ptr;
|
||||||
fci.param_count = 2;
|
fci.param_count = 2;
|
||||||
|
@ -924,7 +924,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
|
||||||
fci.size = sizeof(fci);
|
fci.size = sizeof(fci);
|
||||||
fci.function_table = EG(function_table);
|
fci.function_table = EG(function_table);
|
||||||
fci.function_name = t->func_name;
|
fci.function_name = t->func_name;
|
||||||
fci.object_pp = NULL;
|
fci.object_ptr = NULL;
|
||||||
fci.retval_ptr_ptr = &retval_ptr;
|
fci.retval_ptr_ptr = &retval_ptr;
|
||||||
fci.param_count = 3;
|
fci.param_count = 3;
|
||||||
fci.params = argv;
|
fci.params = argv;
|
||||||
|
@ -1001,7 +1001,7 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
|
||||||
fci.function_table = EG(function_table);
|
fci.function_table = EG(function_table);
|
||||||
fci.function_name = t->func_name;
|
fci.function_name = t->func_name;
|
||||||
fci.symbol_table = NULL;
|
fci.symbol_table = NULL;
|
||||||
fci.object_pp = NULL;
|
fci.object_ptr = NULL;
|
||||||
fci.retval_ptr_ptr = &retval_ptr;
|
fci.retval_ptr_ptr = &retval_ptr;
|
||||||
fci.param_count = 2;
|
fci.param_count = 2;
|
||||||
fci.params = argv;
|
fci.params = argv;
|
||||||
|
|
|
@ -197,7 +197,7 @@ static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs,
|
||||||
|
|
||||||
fci.function_name = &handler;
|
fci.function_name = &handler;
|
||||||
fci.symbol_table = NULL;
|
fci.symbol_table = NULL;
|
||||||
fci.object_pp = NULL;
|
fci.object_ptr = NULL;
|
||||||
fci.retval_ptr_ptr = &retval;
|
fci.retval_ptr_ptr = &retval;
|
||||||
fci.no_separation = 0;
|
fci.no_separation = 0;
|
||||||
/*fci.function_handler_cache = &function_ptr;*/
|
/*fci.function_handler_cache = &function_ptr;*/
|
||||||
|
|
|
@ -2200,7 +2200,7 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type,
|
||||||
fci.function_table = &ce->function_table;
|
fci.function_table = &ce->function_table;
|
||||||
fci.function_name = NULL;
|
fci.function_name = NULL;
|
||||||
fci.symbol_table = NULL;
|
fci.symbol_table = NULL;
|
||||||
fci.object_pp = &return_value;
|
fci.object_ptr = return_value;
|
||||||
fci.retval_ptr_ptr = &retval_ptr;
|
fci.retval_ptr_ptr = &retval_ptr;
|
||||||
if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) {
|
if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) {
|
||||||
if (Z_TYPE_P(ctor_params) == IS_ARRAY) {
|
if (Z_TYPE_P(ctor_params) == IS_ARRAY) {
|
||||||
|
@ -2234,7 +2234,7 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type,
|
||||||
fcc.function_handler = ce->constructor;
|
fcc.function_handler = ce->constructor;
|
||||||
fcc.calling_scope = EG(scope);
|
fcc.calling_scope = EG(scope);
|
||||||
fcc.called_scope = Z_OBJCE_P(return_value);
|
fcc.called_scope = Z_OBJCE_P(return_value);
|
||||||
fcc.object_pp = &return_value;
|
fcc.object_ptr = return_value;
|
||||||
|
|
||||||
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
|
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
|
||||||
zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "Could not execute %v::%v()", ce->name, ce->constructor->common.function_name);
|
zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "Could not execute %v::%v()", ce->name, ce->constructor->common.function_name);
|
||||||
|
|
|
@ -1313,7 +1313,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
|
||||||
fci.function_table = &ce->function_table;
|
fci.function_table = &ce->function_table;
|
||||||
fci.function_name = NULL;
|
fci.function_name = NULL;
|
||||||
fci.symbol_table = NULL;
|
fci.symbol_table = NULL;
|
||||||
fci.object_pp = &return_value;
|
fci.object_ptr = return_value;
|
||||||
fci.retval_ptr_ptr = &retval_ptr;
|
fci.retval_ptr_ptr = &retval_ptr;
|
||||||
if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) {
|
if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) {
|
||||||
if (Z_TYPE_P(ctor_params) == IS_ARRAY) {
|
if (Z_TYPE_P(ctor_params) == IS_ARRAY) {
|
||||||
|
@ -1347,7 +1347,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
|
||||||
fcc.function_handler = ce->constructor;
|
fcc.function_handler = ce->constructor;
|
||||||
fcc.calling_scope = EG(scope);
|
fcc.calling_scope = EG(scope);
|
||||||
fcc.called_scope = Z_OBJCE_P(return_value);
|
fcc.called_scope = Z_OBJCE_P(return_value);
|
||||||
fcc.object_pp = &return_value;
|
fcc.object_ptr = return_value;
|
||||||
|
|
||||||
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
|
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
|
||||||
zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "Could not execute %v::%v()", ce->name, ce->constructor->common.function_name);
|
zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "Could not execute %v::%v()", ce->name, ce->constructor->common.function_name);
|
||||||
|
|
|
@ -460,7 +460,7 @@ static void pdo_stmt_construct(pdo_stmt_t *stmt, zval *object, zend_class_entry
|
||||||
fci.size = sizeof(zend_fcall_info);
|
fci.size = sizeof(zend_fcall_info);
|
||||||
fci.function_table = &dbstmt_ce->function_table;
|
fci.function_table = &dbstmt_ce->function_table;
|
||||||
fci.function_name = NULL;
|
fci.function_name = NULL;
|
||||||
fci.object_pp = &object;
|
fci.object_ptr = object;
|
||||||
fci.symbol_table = NULL;
|
fci.symbol_table = NULL;
|
||||||
fci.retval_ptr_ptr = &retval;
|
fci.retval_ptr_ptr = &retval;
|
||||||
if (ctor_args) {
|
if (ctor_args) {
|
||||||
|
@ -484,7 +484,7 @@ static void pdo_stmt_construct(pdo_stmt_t *stmt, zval *object, zend_class_entry
|
||||||
fcc.function_handler = dbstmt_ce->constructor;
|
fcc.function_handler = dbstmt_ce->constructor;
|
||||||
fcc.calling_scope = EG(scope);
|
fcc.calling_scope = EG(scope);
|
||||||
fcc.called_scope = Z_OBJCE_P(object);
|
fcc.called_scope = Z_OBJCE_P(object);
|
||||||
fcc.object_pp = &object;
|
fcc.object_ptr = object;
|
||||||
|
|
||||||
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
|
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
|
||||||
zval_dtor(object);
|
zval_dtor(object);
|
||||||
|
|
|
@ -777,7 +777,7 @@ static int do_fetch_class_prepare(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
|
||||||
|
|
||||||
static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info * fci, zend_fcall_info_cache * fcc, int num_args TSRMLS_DC) /* {{{ */
|
static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info * fci, zend_fcall_info_cache * fcc, int num_args TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
zval **object = NULL, **method = NULL;
|
zval *object = NULL, **method = NULL;
|
||||||
char *fname = NULL, *cname;
|
char *fname = NULL, *cname;
|
||||||
zend_class_entry * ce = NULL, **pce;
|
zend_class_entry * ce = NULL, **pce;
|
||||||
zend_function *function_handler;
|
zend_function *function_handler;
|
||||||
|
@ -787,19 +787,19 @@ static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info *
|
||||||
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied function must be a valid callback" TSRMLS_CC);
|
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied function must be a valid callback" TSRMLS_CC);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
object = (zval**)Z_ARRVAL_P(callable)->pListHead->pData;
|
object = *(zval**)Z_ARRVAL_P(callable)->pListHead->pData;
|
||||||
method = (zval**)Z_ARRVAL_P(callable)->pListHead->pListNext->pData;
|
method = (zval**)Z_ARRVAL_P(callable)->pListHead->pListNext->pData;
|
||||||
|
|
||||||
if (Z_TYPE_PP(object) == IS_STRING) { /* static call */
|
if (Z_TYPE_P(object) == IS_STRING) { /* static call */
|
||||||
if (zend_lookup_class(Z_STRVAL_PP(object), Z_STRLEN_PP(object), &pce TSRMLS_CC) == FAILURE) {
|
if (zend_lookup_class(Z_STRVAL_P(object), Z_STRLEN_P(object), &pce TSRMLS_CC) == FAILURE) {
|
||||||
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied class does not exist" TSRMLS_CC);
|
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied class does not exist" TSRMLS_CC);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
ce = *pce;
|
ce = *pce;
|
||||||
}
|
}
|
||||||
object = NULL;
|
object = NULL;
|
||||||
} else if (Z_TYPE_PP(object) == IS_OBJECT) { /* object call */
|
} else if (Z_TYPE_P(object) == IS_OBJECT) { /* object call */
|
||||||
ce = Z_OBJCE_PP(object);
|
ce = Z_OBJCE_P(object);
|
||||||
} else {
|
} else {
|
||||||
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied function must be a valid callback; bogus object/class name" TSRMLS_CC);
|
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied function must be a valid callback; bogus object/class name" TSRMLS_CC);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -856,13 +856,13 @@ static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info *
|
||||||
fci->symbol_table = NULL;
|
fci->symbol_table = NULL;
|
||||||
fci->param_count = num_args; /* probably less */
|
fci->param_count = num_args; /* probably less */
|
||||||
fci->params = safe_emalloc(sizeof(zval**), num_args, 0);
|
fci->params = safe_emalloc(sizeof(zval**), num_args, 0);
|
||||||
fci->object_pp = object;
|
fci->object_ptr = object;
|
||||||
|
|
||||||
fcc->initialized = 1;
|
fcc->initialized = 1;
|
||||||
fcc->function_handler = function_handler;
|
fcc->function_handler = function_handler;
|
||||||
fcc->calling_scope = EG(scope);
|
fcc->calling_scope = EG(scope);
|
||||||
fcc->called_scope = object ? Z_OBJCE_PP(object) : NULL;
|
fcc->called_scope = object ? Z_OBJCE_P(object) : NULL;
|
||||||
fcc->object_pp = object;
|
fcc->object_ptr = object;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1035,8 +1035,8 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ce->constructor && (flags & PDO_FETCH_PROPS_LATE)) {
|
if (ce->constructor && (flags & PDO_FETCH_PROPS_LATE)) {
|
||||||
stmt->fetch.cls.fci.object_pp = &return_value;
|
stmt->fetch.cls.fci.object_ptr = return_value;
|
||||||
stmt->fetch.cls.fcc.object_pp = &return_value;
|
stmt->fetch.cls.fcc.object_ptr = return_value;
|
||||||
if (zend_call_function(&stmt->fetch.cls.fci, &stmt->fetch.cls.fcc TSRMLS_CC) == FAILURE) {
|
if (zend_call_function(&stmt->fetch.cls.fci, &stmt->fetch.cls.fcc TSRMLS_CC) == FAILURE) {
|
||||||
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "could not call class constructor" TSRMLS_CC);
|
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "could not call class constructor" TSRMLS_CC);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1240,8 +1240,8 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value,
|
||||||
switch (how) {
|
switch (how) {
|
||||||
case PDO_FETCH_CLASS:
|
case PDO_FETCH_CLASS:
|
||||||
if (ce->constructor && !(flags & PDO_FETCH_PROPS_LATE)) {
|
if (ce->constructor && !(flags & PDO_FETCH_PROPS_LATE)) {
|
||||||
stmt->fetch.cls.fci.object_pp = &return_value;
|
stmt->fetch.cls.fci.object_ptr = return_value;
|
||||||
stmt->fetch.cls.fcc.object_pp = &return_value;
|
stmt->fetch.cls.fcc.object_ptr = return_value;
|
||||||
if (zend_call_function(&stmt->fetch.cls.fci, &stmt->fetch.cls.fcc TSRMLS_CC) == FAILURE) {
|
if (zend_call_function(&stmt->fetch.cls.fci, &stmt->fetch.cls.fcc TSRMLS_CC) == FAILURE) {
|
||||||
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "could not call class constructor" TSRMLS_CC);
|
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "could not call class constructor" TSRMLS_CC);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -332,7 +332,7 @@ static int do_callback(struct pdo_sqlite_fci *fc, zval *cb,
|
||||||
fc->fci.function_table = EG(function_table);
|
fc->fci.function_table = EG(function_table);
|
||||||
fc->fci.function_name = cb;
|
fc->fci.function_name = cb;
|
||||||
fc->fci.symbol_table = NULL;
|
fc->fci.symbol_table = NULL;
|
||||||
fc->fci.object_pp = NULL;
|
fc->fci.object_ptr = NULL;
|
||||||
fc->fci.retval_ptr_ptr = &retval;
|
fc->fci.retval_ptr_ptr = &retval;
|
||||||
fc->fci.param_count = fake_argc;
|
fc->fci.param_count = fake_argc;
|
||||||
|
|
||||||
|
|
|
@ -2515,7 +2515,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
|
||||||
fci.function_table = &ce->function_table;
|
fci.function_table = &ce->function_table;
|
||||||
fci.function_name = NULL;
|
fci.function_name = NULL;
|
||||||
fci.symbol_table = NULL;
|
fci.symbol_table = NULL;
|
||||||
fci.object_pp = &return_value;
|
fci.object_ptr = return_value;
|
||||||
fci.retval_ptr_ptr = &retval_ptr;
|
fci.retval_ptr_ptr = &retval_ptr;
|
||||||
if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) {
|
if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) {
|
||||||
if (Z_TYPE_P(ctor_params) == IS_ARRAY) {
|
if (Z_TYPE_P(ctor_params) == IS_ARRAY) {
|
||||||
|
@ -2549,7 +2549,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
|
||||||
fcc.function_handler = ce->constructor;
|
fcc.function_handler = ce->constructor;
|
||||||
fcc.calling_scope = EG(scope);
|
fcc.calling_scope = EG(scope);
|
||||||
fcc.called_scope = Z_OBJCE_P(return_value);
|
fcc.called_scope = Z_OBJCE_P(return_value);
|
||||||
fcc.object_pp = &return_value;
|
fcc.object_ptr = return_value;
|
||||||
|
|
||||||
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
|
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
|
||||||
zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "Could not execute %s::%s()", ce->name, ce->constructor->common.function_name);
|
zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "Could not execute %s::%s()", ce->name, ce->constructor->common.function_name);
|
||||||
|
|
|
@ -1302,7 +1302,7 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
|
||||||
fci.function_table = NULL;
|
fci.function_table = NULL;
|
||||||
fci.function_name = NULL;
|
fci.function_name = NULL;
|
||||||
fci.symbol_table = NULL;
|
fci.symbol_table = NULL;
|
||||||
fci.object_pp = &reflector_ptr;
|
fci.object_ptr = reflector_ptr;
|
||||||
fci.retval_ptr_ptr = &retval_ptr;
|
fci.retval_ptr_ptr = &retval_ptr;
|
||||||
fci.param_count = ctor_argc;
|
fci.param_count = ctor_argc;
|
||||||
fci.params = params;
|
fci.params = params;
|
||||||
|
@ -1312,7 +1312,7 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
|
||||||
fcc.function_handler = ce_ptr->constructor;
|
fcc.function_handler = ce_ptr->constructor;
|
||||||
fcc.calling_scope = ce_ptr;
|
fcc.calling_scope = ce_ptr;
|
||||||
fcc.called_scope = Z_OBJCE_P(reflector_ptr);
|
fcc.called_scope = Z_OBJCE_P(reflector_ptr);
|
||||||
fcc.object_pp = &reflector_ptr;
|
fcc.object_ptr = reflector_ptr;
|
||||||
|
|
||||||
result = zend_call_function(&fci, &fcc TSRMLS_CC);
|
result = zend_call_function(&fci, &fcc TSRMLS_CC);
|
||||||
|
|
||||||
|
@ -1337,7 +1337,7 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
|
||||||
ZVAL_ASCII_STRINGL(&fname, "reflection::export", sizeof("reflection::export") - 1, 1);
|
ZVAL_ASCII_STRINGL(&fname, "reflection::export", sizeof("reflection::export") - 1, 1);
|
||||||
fci.function_table = &reflection_ptr->function_table;
|
fci.function_table = &reflection_ptr->function_table;
|
||||||
fci.function_name = &fname;
|
fci.function_name = &fname;
|
||||||
fci.object_pp = NULL;
|
fci.object_ptr = NULL;
|
||||||
fci.retval_ptr_ptr = &retval_ptr;
|
fci.retval_ptr_ptr = &retval_ptr;
|
||||||
fci.param_count = 2;
|
fci.param_count = 2;
|
||||||
fci.params = params;
|
fci.params = params;
|
||||||
|
@ -1684,7 +1684,7 @@ ZEND_METHOD(reflection_function, invoke)
|
||||||
fci.function_table = NULL;
|
fci.function_table = NULL;
|
||||||
fci.function_name = NULL;
|
fci.function_name = NULL;
|
||||||
fci.symbol_table = NULL;
|
fci.symbol_table = NULL;
|
||||||
fci.object_pp = NULL;
|
fci.object_ptr = NULL;
|
||||||
fci.retval_ptr_ptr = &retval_ptr;
|
fci.retval_ptr_ptr = &retval_ptr;
|
||||||
fci.param_count = num_args;
|
fci.param_count = num_args;
|
||||||
fci.params = params;
|
fci.params = params;
|
||||||
|
@ -1694,7 +1694,7 @@ ZEND_METHOD(reflection_function, invoke)
|
||||||
fcc.function_handler = fptr;
|
fcc.function_handler = fptr;
|
||||||
fcc.calling_scope = EG(scope);
|
fcc.calling_scope = EG(scope);
|
||||||
fcc.called_scope = NULL;
|
fcc.called_scope = NULL;
|
||||||
fcc.object_pp = NULL;
|
fcc.object_ptr = NULL;
|
||||||
|
|
||||||
result = zend_call_function(&fci, &fcc TSRMLS_CC);
|
result = zend_call_function(&fci, &fcc TSRMLS_CC);
|
||||||
|
|
||||||
|
@ -1749,7 +1749,7 @@ ZEND_METHOD(reflection_function, invokeArgs)
|
||||||
fci.function_table = NULL;
|
fci.function_table = NULL;
|
||||||
fci.function_name = NULL;
|
fci.function_name = NULL;
|
||||||
fci.symbol_table = NULL;
|
fci.symbol_table = NULL;
|
||||||
fci.object_pp = NULL;
|
fci.object_ptr = NULL;
|
||||||
fci.retval_ptr_ptr = &retval_ptr;
|
fci.retval_ptr_ptr = &retval_ptr;
|
||||||
fci.param_count = argc;
|
fci.param_count = argc;
|
||||||
fci.params = params;
|
fci.params = params;
|
||||||
|
@ -1759,7 +1759,7 @@ ZEND_METHOD(reflection_function, invokeArgs)
|
||||||
fcc.function_handler = fptr;
|
fcc.function_handler = fptr;
|
||||||
fcc.calling_scope = EG(scope);
|
fcc.calling_scope = EG(scope);
|
||||||
fcc.called_scope = NULL;
|
fcc.called_scope = NULL;
|
||||||
fcc.object_pp = NULL;
|
fcc.object_ptr = NULL;
|
||||||
|
|
||||||
result = zend_call_function(&fci, &fcc TSRMLS_CC);
|
result = zend_call_function(&fci, &fcc TSRMLS_CC);
|
||||||
|
|
||||||
|
@ -2514,7 +2514,7 @@ ZEND_METHOD(reflection_method, invoke)
|
||||||
{
|
{
|
||||||
zval *retval_ptr;
|
zval *retval_ptr;
|
||||||
zval ***params = NULL;
|
zval ***params = NULL;
|
||||||
zval **object_pp;
|
zval *object_ptr;
|
||||||
reflection_object *intern;
|
reflection_object *intern;
|
||||||
zend_function *mptr;
|
zend_function *mptr;
|
||||||
int result, num_args = 0;
|
int result, num_args = 0;
|
||||||
|
@ -2547,14 +2547,14 @@ ZEND_METHOD(reflection_method, invoke)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In case this is a static method, we should'nt pass an object_pp
|
/* In case this is a static method, we should'nt pass an object_ptr
|
||||||
* (which is used as calling context aka $this). We can thus ignore the
|
* (which is used as calling context aka $this). We can thus ignore the
|
||||||
* first parameter.
|
* first parameter.
|
||||||
*
|
*
|
||||||
* Else, we verify that the given object is an instance of the class.
|
* Else, we verify that the given object is an instance of the class.
|
||||||
*/
|
*/
|
||||||
if (mptr->common.fn_flags & ZEND_ACC_STATIC) {
|
if (mptr->common.fn_flags & ZEND_ACC_STATIC) {
|
||||||
object_pp = NULL;
|
object_ptr = NULL;
|
||||||
obj_ce = mptr->common.scope;
|
obj_ce = mptr->common.scope;
|
||||||
} else {
|
} else {
|
||||||
if ((Z_TYPE_PP(params[0]) != IS_OBJECT)) {
|
if ((Z_TYPE_PP(params[0]) != IS_OBJECT)) {
|
||||||
|
@ -2570,14 +2570,14 @@ ZEND_METHOD(reflection_method, invoke)
|
||||||
/* Returns from this function */
|
/* Returns from this function */
|
||||||
}
|
}
|
||||||
|
|
||||||
object_pp = params[0];
|
object_ptr = *params[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
fci.size = sizeof(fci);
|
fci.size = sizeof(fci);
|
||||||
fci.function_table = NULL;
|
fci.function_table = NULL;
|
||||||
fci.function_name = NULL;
|
fci.function_name = NULL;
|
||||||
fci.symbol_table = NULL;
|
fci.symbol_table = NULL;
|
||||||
fci.object_pp = object_pp;
|
fci.object_ptr = object_ptr;
|
||||||
fci.retval_ptr_ptr = &retval_ptr;
|
fci.retval_ptr_ptr = &retval_ptr;
|
||||||
fci.param_count = num_args-1;
|
fci.param_count = num_args-1;
|
||||||
fci.params = params+1;
|
fci.params = params+1;
|
||||||
|
@ -2587,7 +2587,7 @@ ZEND_METHOD(reflection_method, invoke)
|
||||||
fcc.function_handler = mptr;
|
fcc.function_handler = mptr;
|
||||||
fcc.calling_scope = obj_ce;
|
fcc.calling_scope = obj_ce;
|
||||||
fcc.called_scope = obj_ce;
|
fcc.called_scope = obj_ce;
|
||||||
fcc.object_pp = object_pp;
|
fcc.object_ptr = object_ptr;
|
||||||
|
|
||||||
result = zend_call_function(&fci, &fcc TSRMLS_CC);
|
result = zend_call_function(&fci, &fcc TSRMLS_CC);
|
||||||
|
|
||||||
|
@ -2652,7 +2652,7 @@ ZEND_METHOD(reflection_method, invokeArgs)
|
||||||
zend_hash_apply_with_argument(Z_ARRVAL_P(param_array), (apply_func_arg_t)_zval_array_to_c_array, ¶ms TSRMLS_CC);
|
zend_hash_apply_with_argument(Z_ARRVAL_P(param_array), (apply_func_arg_t)_zval_array_to_c_array, ¶ms TSRMLS_CC);
|
||||||
params -= argc;
|
params -= argc;
|
||||||
|
|
||||||
/* In case this is a static method, we should'nt pass an object_pp
|
/* In case this is a static method, we should'nt pass an object_ptr
|
||||||
* (which is used as calling context aka $this). We can thus ignore the
|
* (which is used as calling context aka $this). We can thus ignore the
|
||||||
* first parameter.
|
* first parameter.
|
||||||
*
|
*
|
||||||
|
@ -2683,7 +2683,7 @@ ZEND_METHOD(reflection_method, invokeArgs)
|
||||||
fci.function_table = NULL;
|
fci.function_table = NULL;
|
||||||
fci.function_name = NULL;
|
fci.function_name = NULL;
|
||||||
fci.symbol_table = NULL;
|
fci.symbol_table = NULL;
|
||||||
fci.object_pp = &object;
|
fci.object_ptr = object;
|
||||||
fci.retval_ptr_ptr = &retval_ptr;
|
fci.retval_ptr_ptr = &retval_ptr;
|
||||||
fci.param_count = argc;
|
fci.param_count = argc;
|
||||||
fci.params = params;
|
fci.params = params;
|
||||||
|
@ -2693,7 +2693,7 @@ ZEND_METHOD(reflection_method, invokeArgs)
|
||||||
fcc.function_handler = mptr;
|
fcc.function_handler = mptr;
|
||||||
fcc.calling_scope = obj_ce;
|
fcc.calling_scope = obj_ce;
|
||||||
fcc.called_scope = obj_ce;
|
fcc.called_scope = obj_ce;
|
||||||
fcc.object_pp = object ? &object : NULL;
|
fcc.object_ptr = object;
|
||||||
|
|
||||||
result = zend_call_function(&fci, &fcc TSRMLS_CC);
|
result = zend_call_function(&fci, &fcc TSRMLS_CC);
|
||||||
|
|
||||||
|
@ -3819,7 +3819,7 @@ ZEND_METHOD(reflection_class, newInstance)
|
||||||
fci.function_table = EG(function_table);
|
fci.function_table = EG(function_table);
|
||||||
fci.function_name = NULL;
|
fci.function_name = NULL;
|
||||||
fci.symbol_table = NULL;
|
fci.symbol_table = NULL;
|
||||||
fci.object_pp = &return_value;
|
fci.object_ptr = return_value;
|
||||||
fci.retval_ptr_ptr = &retval_ptr;
|
fci.retval_ptr_ptr = &retval_ptr;
|
||||||
fci.param_count = num_args;
|
fci.param_count = num_args;
|
||||||
fci.params = params;
|
fci.params = params;
|
||||||
|
@ -3829,7 +3829,7 @@ ZEND_METHOD(reflection_class, newInstance)
|
||||||
fcc.function_handler = ce->constructor;
|
fcc.function_handler = ce->constructor;
|
||||||
fcc.calling_scope = EG(scope);
|
fcc.calling_scope = EG(scope);
|
||||||
fcc.called_scope = Z_OBJCE_P(return_value);
|
fcc.called_scope = Z_OBJCE_P(return_value);
|
||||||
fcc.object_pp = &return_value;
|
fcc.object_ptr = return_value;
|
||||||
|
|
||||||
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
|
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
|
||||||
efree(params);
|
efree(params);
|
||||||
|
@ -3898,7 +3898,7 @@ ZEND_METHOD(reflection_class, newInstanceArgs)
|
||||||
fci.function_table = EG(function_table);
|
fci.function_table = EG(function_table);
|
||||||
fci.function_name = NULL;
|
fci.function_name = NULL;
|
||||||
fci.symbol_table = NULL;
|
fci.symbol_table = NULL;
|
||||||
fci.object_pp = &return_value;
|
fci.object_ptr = return_value;
|
||||||
fci.retval_ptr_ptr = &retval_ptr;
|
fci.retval_ptr_ptr = &retval_ptr;
|
||||||
fci.param_count = argc;
|
fci.param_count = argc;
|
||||||
fci.params = params;
|
fci.params = params;
|
||||||
|
@ -3908,7 +3908,7 @@ ZEND_METHOD(reflection_class, newInstanceArgs)
|
||||||
fcc.function_handler = ce->constructor;
|
fcc.function_handler = ce->constructor;
|
||||||
fcc.calling_scope = EG(scope);
|
fcc.calling_scope = EG(scope);
|
||||||
fcc.called_scope = Z_OBJCE_P(return_value);
|
fcc.called_scope = Z_OBJCE_P(return_value);
|
||||||
fcc.object_pp = &return_value;
|
fcc.object_ptr = return_value;
|
||||||
|
|
||||||
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
|
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
|
||||||
if (params) {
|
if (params) {
|
||||||
|
|
|
@ -1283,7 +1283,7 @@ PHP_METHOD(SoapFault, __toString)
|
||||||
fci.function_table = &Z_OBJCE_P(getThis())->function_table;
|
fci.function_table = &Z_OBJCE_P(getThis())->function_table;
|
||||||
fci.function_name = &fname;
|
fci.function_name = &fname;
|
||||||
fci.symbol_table = NULL;
|
fci.symbol_table = NULL;
|
||||||
fci.object_pp = &getThis();
|
fci.object_ptr = getThis();
|
||||||
fci.retval_ptr_ptr = &trace;
|
fci.retval_ptr_ptr = &trace;
|
||||||
fci.param_count = 0;
|
fci.param_count = 0;
|
||||||
fci.params = NULL;
|
fci.params = NULL;
|
||||||
|
|
|
@ -415,7 +415,7 @@ PHP_FUNCTION(spl_autoload_register)
|
||||||
zend_bool prepend = 0;
|
zend_bool prepend = 0;
|
||||||
zend_function *spl_func_ptr;
|
zend_function *spl_func_ptr;
|
||||||
autoload_func_info alfi;
|
autoload_func_info alfi;
|
||||||
zval **obj_ptr;
|
zval *obj_ptr;
|
||||||
zend_fcall_info_cache fcc;
|
zend_fcall_info_cache fcc;
|
||||||
|
|
||||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "|zbb", &zcallable, &do_throw, &prepend) == FAILURE) {
|
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "|zbb", &zcallable, &do_throw, &prepend) == FAILURE) {
|
||||||
|
@ -449,7 +449,7 @@ PHP_FUNCTION(spl_autoload_register)
|
||||||
if (!zend_is_callable_ex(zcallable, NULL, IS_CALLABLE_STRICT, &zfunc_name, &fcc, &error TSRMLS_CC)) {
|
if (!zend_is_callable_ex(zcallable, NULL, IS_CALLABLE_STRICT, &zfunc_name, &fcc, &error TSRMLS_CC)) {
|
||||||
alfi.ce = fcc.calling_scope;
|
alfi.ce = fcc.calling_scope;
|
||||||
alfi.func_ptr = fcc.function_handler;
|
alfi.func_ptr = fcc.function_handler;
|
||||||
obj_ptr = fcc.object_pp;
|
obj_ptr = fcc.object_ptr;
|
||||||
if (Z_TYPE_P(zcallable) == IS_ARRAY) {
|
if (Z_TYPE_P(zcallable) == IS_ARRAY) {
|
||||||
if (!obj_ptr && alfi.func_ptr && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) {
|
if (!obj_ptr && alfi.func_ptr && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) {
|
||||||
if (do_throw) {
|
if (do_throw) {
|
||||||
|
@ -491,7 +491,7 @@ PHP_FUNCTION(spl_autoload_register)
|
||||||
}
|
}
|
||||||
alfi.ce = fcc.calling_scope;
|
alfi.ce = fcc.calling_scope;
|
||||||
alfi.func_ptr = fcc.function_handler;
|
alfi.func_ptr = fcc.function_handler;
|
||||||
obj_ptr = fcc.object_pp;
|
obj_ptr = fcc.object_ptr;
|
||||||
if (error) {
|
if (error) {
|
||||||
efree(error);
|
efree(error);
|
||||||
}
|
}
|
||||||
|
@ -506,9 +506,9 @@ PHP_FUNCTION(spl_autoload_register)
|
||||||
zstr lc_name;
|
zstr lc_name;
|
||||||
size_t func_name_len = Z_UNISIZE(zfunc_name);
|
size_t func_name_len = Z_UNISIZE(zfunc_name);
|
||||||
lc_name.v = Z_UNIVAL(zfunc_name).v = erealloc(Z_UNIVAL(zfunc_name).v, func_name_len + 2 + sizeof(zend_object_handle));
|
lc_name.v = Z_UNIVAL(zfunc_name).v = erealloc(Z_UNIVAL(zfunc_name).v, func_name_len + 2 + sizeof(zend_object_handle));
|
||||||
memcpy(lc_name.s + func_name_len, &Z_OBJ_HANDLE_PP(obj_ptr), sizeof(zend_object_handle));
|
memcpy(lc_name.s + func_name_len, &Z_OBJ_HANDLE_P(obj_ptr), sizeof(zend_object_handle));
|
||||||
func_name_len += sizeof(zend_object_handle);
|
func_name_len += sizeof(zend_object_handle);
|
||||||
alfi.obj = *obj_ptr;
|
alfi.obj = obj_ptr;
|
||||||
Z_ADDREF_P(alfi.obj);
|
Z_ADDREF_P(alfi.obj);
|
||||||
if (Z_TYPE(zfunc_name) == IS_UNICODE) {
|
if (Z_TYPE(zfunc_name) == IS_UNICODE) {
|
||||||
func_name_len /= sizeof(UChar);
|
func_name_len /= sizeof(UChar);
|
||||||
|
@ -569,7 +569,7 @@ PHP_FUNCTION(spl_autoload_unregister)
|
||||||
zstr lc_name;
|
zstr lc_name;
|
||||||
int success = FAILURE;
|
int success = FAILURE;
|
||||||
zend_function *spl_func_ptr;
|
zend_function *spl_func_ptr;
|
||||||
zval **obj_ptr;
|
zval *obj_ptr;
|
||||||
zend_fcall_info_cache fcc;
|
zend_fcall_info_cache fcc;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zcallable) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zcallable) == FAILURE) {
|
||||||
|
@ -584,7 +584,7 @@ PHP_FUNCTION(spl_autoload_unregister)
|
||||||
zval_dtor(&zfunc_name);
|
zval_dtor(&zfunc_name);
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
obj_ptr = fcc.object_pp;
|
obj_ptr = fcc.object_ptr;
|
||||||
if (error) {
|
if (error) {
|
||||||
efree(error);
|
efree(error);
|
||||||
}
|
}
|
||||||
|
@ -606,7 +606,7 @@ PHP_FUNCTION(spl_autoload_unregister)
|
||||||
if (success != SUCCESS && obj_ptr) {
|
if (success != SUCCESS && obj_ptr) {
|
||||||
size_t func_name_len = Z_UNISIZE(zfunc_name);
|
size_t func_name_len = Z_UNISIZE(zfunc_name);
|
||||||
lc_name.v = erealloc(lc_name.v, func_name_len + 2 + sizeof(zend_object_handle));
|
lc_name.v = erealloc(lc_name.v, func_name_len + 2 + sizeof(zend_object_handle));
|
||||||
memcpy(lc_name.s + func_name_len, &Z_OBJ_HANDLE_PP(obj_ptr), sizeof(zend_object_handle));
|
memcpy(lc_name.s + func_name_len, &Z_OBJ_HANDLE_P(obj_ptr), sizeof(zend_object_handle));
|
||||||
func_name_len += sizeof(zend_object_handle);
|
func_name_len += sizeof(zend_object_handle);
|
||||||
if (Z_TYPE(zfunc_name) == IS_UNICODE) {
|
if (Z_TYPE(zfunc_name) == IS_UNICODE) {
|
||||||
func_name_len /= sizeof(UChar);
|
func_name_len /= sizeof(UChar);
|
||||||
|
|
|
@ -1948,7 +1948,7 @@ static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function
|
||||||
|
|
||||||
fci.size = sizeof(fci);
|
fci.size = sizeof(fci);
|
||||||
fci.function_table = EG(function_table);
|
fci.function_table = EG(function_table);
|
||||||
fci.object_pp = NULL;
|
fci.object_ptr = NULL;
|
||||||
fci.function_name = &z_fname;
|
fci.function_name = &z_fname;
|
||||||
fci.retval_ptr_ptr = &retval;
|
fci.retval_ptr_ptr = &retval;
|
||||||
fci.param_count = num_args;
|
fci.param_count = num_args;
|
||||||
|
@ -1960,7 +1960,7 @@ static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function
|
||||||
fcic.function_handler = func_ptr;
|
fcic.function_handler = func_ptr;
|
||||||
fcic.calling_scope = NULL;
|
fcic.calling_scope = NULL;
|
||||||
fcic.called_scope = NULL;
|
fcic.called_scope = NULL;
|
||||||
fcic.object_pp = NULL;
|
fcic.object_ptr = NULL;
|
||||||
|
|
||||||
result = zend_call_function(&fci, &fcic TSRMLS_CC);
|
result = zend_call_function(&fci, &fcic TSRMLS_CC);
|
||||||
|
|
||||||
|
|
|
@ -2619,7 +2619,7 @@ PHP_FUNCTION(sqlite_fetch_object)
|
||||||
fci.function_table = &ce->function_table;
|
fci.function_table = &ce->function_table;
|
||||||
fci.function_name = NULL;
|
fci.function_name = NULL;
|
||||||
fci.symbol_table = NULL;
|
fci.symbol_table = NULL;
|
||||||
fci.object_pp = &return_value;
|
fci.object_ptr = return_value;
|
||||||
fci.retval_ptr_ptr = &retval_ptr;
|
fci.retval_ptr_ptr = &retval_ptr;
|
||||||
if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) {
|
if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) {
|
||||||
if (Z_TYPE_P(ctor_params) == IS_ARRAY) {
|
if (Z_TYPE_P(ctor_params) == IS_ARRAY) {
|
||||||
|
@ -2653,7 +2653,7 @@ PHP_FUNCTION(sqlite_fetch_object)
|
||||||
fcc.function_handler = ce->constructor;
|
fcc.function_handler = ce->constructor;
|
||||||
fcc.calling_scope = EG(scope);
|
fcc.calling_scope = EG(scope);
|
||||||
fcc.called_scope = Z_OBJCE_P(return_value);
|
fcc.called_scope = Z_OBJCE_P(return_value);
|
||||||
fcc.object_pp = &return_value;
|
fcc.object_ptr = return_value;
|
||||||
|
|
||||||
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
|
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
|
||||||
zend_throw_exception_ex(sqlite_ce_exception, 0 TSRMLS_CC, "Could not execute %s::%v()", class_name, ce->constructor->common.function_name);
|
zend_throw_exception_ex(sqlite_ce_exception, 0 TSRMLS_CC, "Could not execute %s::%v()", class_name, ce->constructor->common.function_name);
|
||||||
|
|
|
@ -631,7 +631,7 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s
|
||||||
fc->fci.function_table = EG(function_table);
|
fc->fci.function_table = EG(function_table);
|
||||||
fc->fci.function_name = cb;
|
fc->fci.function_name = cb;
|
||||||
fc->fci.symbol_table = NULL;
|
fc->fci.symbol_table = NULL;
|
||||||
fc->fci.object_pp = NULL;
|
fc->fci.object_ptr = NULL;
|
||||||
fc->fci.retval_ptr_ptr = &retval;
|
fc->fci.retval_ptr_ptr = &retval;
|
||||||
fc->fci.param_count = fake_argc;
|
fc->fci.param_count = fake_argc;
|
||||||
|
|
||||||
|
|
|
@ -528,7 +528,7 @@ static zval *xml_call_handler(xml_parser *parser, zval *handler, zend_function *
|
||||||
fci.function_table = EG(function_table);
|
fci.function_table = EG(function_table);
|
||||||
fci.function_name = handler;
|
fci.function_name = handler;
|
||||||
fci.symbol_table = NULL;
|
fci.symbol_table = NULL;
|
||||||
fci.object_pp = &parser->object;
|
fci.object_ptr = parser->object;
|
||||||
fci.retval_ptr_ptr = &retval;
|
fci.retval_ptr_ptr = &retval;
|
||||||
fci.param_count = argc;
|
fci.param_count = argc;
|
||||||
fci.params = args;
|
fci.params = args;
|
||||||
|
|
|
@ -307,7 +307,7 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
|
||||||
|
|
||||||
fci.function_name = &handler;
|
fci.function_name = &handler;
|
||||||
fci.symbol_table = NULL;
|
fci.symbol_table = NULL;
|
||||||
fci.object_pp = NULL;
|
fci.object_ptr = NULL;
|
||||||
fci.retval_ptr_ptr = &retval;
|
fci.retval_ptr_ptr = &retval;
|
||||||
fci.no_separation = 0;
|
fci.no_separation = 0;
|
||||||
/*fci.function_handler_cache = &function_ptr;*/
|
/*fci.function_handler_cache = &function_ptr;*/
|
||||||
|
|
|
@ -299,7 +299,7 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, char *filena
|
||||||
fci.function_table = &uwrap->ce->function_table;
|
fci.function_table = &uwrap->ce->function_table;
|
||||||
fci.function_name = NULL;
|
fci.function_name = NULL;
|
||||||
fci.symbol_table = NULL;
|
fci.symbol_table = NULL;
|
||||||
fci.object_pp = &us->object;
|
fci.object_ptr = us->object;
|
||||||
fci.retval_ptr_ptr = &retval_ptr;
|
fci.retval_ptr_ptr = &retval_ptr;
|
||||||
fci.param_count = 0;
|
fci.param_count = 0;
|
||||||
fci.params = NULL;
|
fci.params = NULL;
|
||||||
|
@ -309,7 +309,7 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, char *filena
|
||||||
fcc.function_handler = uwrap->ce->constructor;
|
fcc.function_handler = uwrap->ce->constructor;
|
||||||
fcc.calling_scope = EG(scope);
|
fcc.calling_scope = EG(scope);
|
||||||
fcc.called_scope = Z_OBJCE_P(us->object);
|
fcc.called_scope = Z_OBJCE_P(us->object);
|
||||||
fcc.object_pp = &us->object;
|
fcc.object_ptr = us->object;
|
||||||
|
|
||||||
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
|
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute %s::%s()", uwrap->ce->name, uwrap->ce->constructor->common.function_name);
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute %s::%s()", uwrap->ce->name, uwrap->ce->constructor->common.function_name);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue