version 1.1.1.1, 2012/02/21 23:47:52
|
version 1.1.1.5, 2014/06/15 20:04:03
|
Line 2
|
Line 2
|
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| Zend Engine | |
| Zend Engine | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) | | | Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| This source file is subject to version 2.00 of the Zend license, | |
| This source file is subject to version 2.00 of the Zend license, | |
| that is bundled with this package in the file LICENSE, and is | |
| that is bundled with this package in the file LICENSE, and is | |
Line 33
|
Line 33
|
#endif |
#endif |
|
|
/* these variables are true statics/globals, and have to be mutex'ed on every access */ |
/* these variables are true statics/globals, and have to be mutex'ed on every access */ |
static int module_count=0; |
|
ZEND_API HashTable module_registry; |
ZEND_API HashTable module_registry; |
|
|
|
static zend_module_entry **module_request_startup_handlers; |
|
static zend_module_entry **module_request_shutdown_handlers; |
|
static zend_module_entry **module_post_deactivate_handlers; |
|
|
|
static zend_class_entry **class_cleanup_handlers; |
|
|
/* this function doesn't check for too many parameters */ |
/* this function doesn't check for too many parameters */ |
ZEND_API int zend_get_parameters(int ht, int param_count, ...) /* {{{ */ |
ZEND_API int zend_get_parameters(int ht, int param_count, ...) /* {{{ */ |
{ |
{ |
Line 186 ZEND_API int zend_copy_parameters_array(int param_coun
|
Line 191 ZEND_API int zend_copy_parameters_array(int param_coun
|
|
|
ZEND_API void zend_wrong_param_count(TSRMLS_D) /* {{{ */ |
ZEND_API void zend_wrong_param_count(TSRMLS_D) /* {{{ */ |
{ |
{ |
char *space; | const char *space; |
char *class_name = get_active_class_name(&space TSRMLS_CC); | const char *class_name = get_active_class_name(&space TSRMLS_CC); |
|
|
zend_error(E_WARNING, "Wrong parameter count for %s%s%s()", class_name, space, get_active_function_name(TSRMLS_C)); |
zend_error(E_WARNING, "Wrong parameter count for %s%s%s()", class_name, space, get_active_function_name(TSRMLS_C)); |
} |
} |
Line 211 ZEND_API char *zend_get_type_by_const(int type) /* {{{
|
Line 216 ZEND_API char *zend_get_type_by_const(int type) /* {{{
|
return "resource"; |
return "resource"; |
case IS_NULL: |
case IS_NULL: |
return "null"; |
return "null"; |
|
case IS_CALLABLE: |
|
return "callable"; |
case IS_ARRAY: |
case IS_ARRAY: |
return "array"; |
return "array"; |
default: |
default: |
Line 237 ZEND_API zend_class_entry *zend_get_class_entry(const
|
Line 244 ZEND_API zend_class_entry *zend_get_class_entry(const
|
/* }}} */ |
/* }}} */ |
|
|
/* returns 1 if you need to copy result, 0 if it's already a copy */ |
/* returns 1 if you need to copy result, 0 if it's already a copy */ |
ZEND_API int zend_get_object_classname(const zval *object, char **class_name, zend_uint *class_name_len TSRMLS_DC) /* {{{ */ | ZEND_API int zend_get_object_classname(const zval *object, const char **class_name, zend_uint *class_name_len TSRMLS_DC) /* {{{ */ |
{ |
{ |
if (Z_OBJ_HT_P(object)->get_class_name == NULL || |
if (Z_OBJ_HT_P(object)->get_class_name == NULL || |
Z_OBJ_HT_P(object)->get_class_name(object, class_name, class_name_len, 0 TSRMLS_CC) != SUCCESS) { |
Z_OBJ_HT_P(object)->get_class_name(object, class_name, class_name_len, 0 TSRMLS_CC) != SUCCESS) { |
Line 251 ZEND_API int zend_get_object_classname(const zval *obj
|
Line 258 ZEND_API int zend_get_object_classname(const zval *obj
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
static int parse_arg_object_to_string(zval **arg TSRMLS_DC) /* {{{ */ | static int parse_arg_object_to_string(zval **arg, char **p, int *pl, int type TSRMLS_DC) /* {{{ */ |
{ |
{ |
if (Z_OBJ_HANDLER_PP(arg, cast_object)) { |
if (Z_OBJ_HANDLER_PP(arg, cast_object)) { |
SEPARATE_ZVAL_IF_NOT_REF(arg); | zval *obj; |
if (Z_OBJ_HANDLER_PP(arg, cast_object)(*arg, *arg, IS_STRING TSRMLS_CC) == SUCCESS) { | MAKE_STD_ZVAL(obj); |
| if (Z_OBJ_HANDLER_P(*arg, cast_object)(*arg, obj, type TSRMLS_CC) == SUCCESS) { |
| zval_ptr_dtor(arg); |
| *arg = obj; |
| *pl = Z_STRLEN_PP(arg); |
| *p = Z_STRVAL_PP(arg); |
return SUCCESS; |
return SUCCESS; |
} |
} |
|
efree(obj); |
} |
} |
/* Standard PHP objects */ |
/* Standard PHP objects */ |
if (Z_OBJ_HT_PP(arg) == &std_object_handlers || !Z_OBJ_HANDLER_PP(arg, cast_object)) { |
if (Z_OBJ_HT_PP(arg) == &std_object_handlers || !Z_OBJ_HANDLER_PP(arg, cast_object)) { |
SEPARATE_ZVAL_IF_NOT_REF(arg); |
SEPARATE_ZVAL_IF_NOT_REF(arg); |
if (zend_std_cast_object_tostring(*arg, *arg, IS_STRING TSRMLS_CC) == SUCCESS) { | if (zend_std_cast_object_tostring(*arg, *arg, type TSRMLS_CC) == SUCCESS) { |
| *pl = Z_STRLEN_PP(arg); |
| *p = Z_STRVAL_PP(arg); |
return SUCCESS; |
return SUCCESS; |
} |
} |
} |
} |
Line 277 static int parse_arg_object_to_string(zval **arg TSRML
|
Line 292 static int parse_arg_object_to_string(zval **arg TSRML
|
if (!use_copy) { |
if (!use_copy) { |
ZVAL_ZVAL(*arg, z, 1, 1); |
ZVAL_ZVAL(*arg, z, 1, 1); |
} |
} |
|
*pl = Z_STRLEN_PP(arg); |
|
*p = Z_STRVAL_PP(arg); |
return SUCCESS; |
return SUCCESS; |
} |
} |
zval_ptr_dtor(&z); |
zval_ptr_dtor(&z); |
Line 285 static int parse_arg_object_to_string(zval **arg TSRML
|
Line 302 static int parse_arg_object_to_string(zval **arg TSRML
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **spec, char **error, int *severity TSRMLS_DC) /* {{{ */ | static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, const char **spec, char **error, int *severity TSRMLS_DC) /* {{{ */ |
{ |
{ |
char *spec_walk = *spec; | const char *spec_walk = *spec; |
char c = *spec_walk++; |
char c = *spec_walk++; |
int return_null = 0; |
int return_null = 0; |
|
|
Line 394 static char *zend_parse_arg_impl(int arg_num, zval **a
|
Line 411 static char *zend_parse_arg_impl(int arg_num, zval **a
|
} |
} |
break; |
break; |
|
|
|
case 'p': |
case 's': |
case 's': |
{ |
{ |
char **p = va_arg(*va, char **); |
char **p = va_arg(*va, char **); |
Line 420 static char *zend_parse_arg_impl(int arg_num, zval **a
|
Line 438 static char *zend_parse_arg_impl(int arg_num, zval **a
|
} |
} |
*p = Z_STRVAL_PP(arg); |
*p = Z_STRVAL_PP(arg); |
*pl = Z_STRLEN_PP(arg); |
*pl = Z_STRLEN_PP(arg); |
|
if (c == 'p' && CHECK_ZVAL_NULL_PATH(*arg)) { |
|
return "a valid path"; |
|
} |
break; |
break; |
|
|
case IS_OBJECT: |
case IS_OBJECT: |
|
if (parse_arg_object_to_string(arg, p, pl, IS_STRING TSRMLS_CC) == SUCCESS) { |
|
if (c == 'p' && CHECK_ZVAL_NULL_PATH(*arg)) { |
|
return "a valid path"; |
|
} |
|
break; |
|
} |
|
|
case IS_ARRAY: |
case IS_ARRAY: |
case IS_RESOURCE: |
case IS_RESOURCE: |
default: |
default: |
return "string"; | return c == 's' ? "string" : "a valid path"; |
} |
} |
} |
} |
break; |
break; |
Line 638 static char *zend_parse_arg_impl(int arg_num, zval **a
|
Line 666 static char *zend_parse_arg_impl(int arg_num, zval **a
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
static int zend_parse_arg(int arg_num, zval **arg, va_list *va, char **spec, int quiet TSRMLS_DC) /* {{{ */ | static int zend_parse_arg(int arg_num, zval **arg, va_list *va, const char **spec, int quiet TSRMLS_DC) /* {{{ */ |
{ |
{ |
char *expected_type = NULL, *error = NULL; | const char *expected_type = NULL; |
| char *error = NULL; |
int severity = E_WARNING; |
int severity = E_WARNING; |
|
|
expected_type = zend_parse_arg_impl(arg_num, arg, va, spec, &error, &severity TSRMLS_CC); |
expected_type = zend_parse_arg_impl(arg_num, arg, va, spec, &error, &severity TSRMLS_CC); |
if (expected_type) { |
if (expected_type) { |
if (!quiet && (*expected_type || error)) { |
if (!quiet && (*expected_type || error)) { |
char *space; | const char *space; |
char *class_name = get_active_class_name(&space TSRMLS_CC); | const char *class_name = get_active_class_name(&space TSRMLS_CC); |
|
|
if (error) { |
if (error) { |
zend_error(severity, "%s%s%s() expects parameter %d %s", |
zend_error(severity, "%s%s%s() expects parameter %d %s", |
Line 668 static int zend_parse_arg(int arg_num, zval **arg, va_
|
Line 697 static int zend_parse_arg(int arg_num, zval **arg, va_
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int flags TSRMLS_DC) /* {{{ */ | static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va, int flags TSRMLS_DC) /* {{{ */ |
{ |
{ |
char *spec_walk; | const char *spec_walk; |
int c, i; |
int c, i; |
int min_num_args = -1; |
int min_num_args = -1; |
int max_num_args = 0; |
int max_num_args = 0; |
int post_varargs = 0; |
int post_varargs = 0; |
zval **arg; |
zval **arg; |
int arg_count = (int)(zend_uintptr_t) *(zend_vm_stack_top(TSRMLS_C) - 1); | int arg_count; |
int quiet = flags & ZEND_PARSE_PARAMS_QUIET; |
int quiet = flags & ZEND_PARSE_PARAMS_QUIET; |
zend_bool have_varargs = 0; |
zend_bool have_varargs = 0; |
zval ****varargs = NULL; |
zval ****varargs = NULL; |
Line 685 static int zend_parse_va_args(int num_args, char *type
|
Line 714 static int zend_parse_va_args(int num_args, char *type
|
for (spec_walk = type_spec; *spec_walk; spec_walk++) { |
for (spec_walk = type_spec; *spec_walk; spec_walk++) { |
c = *spec_walk; |
c = *spec_walk; |
switch (c) { |
switch (c) { |
case 's': |
|
if (max_num_args < arg_count) { |
|
arg = (zval **) (zend_vm_stack_top(TSRMLS_C) - 1 - (arg_count - max_num_args)); |
|
if (Z_TYPE_PP(arg) == IS_OBJECT) { |
|
parse_arg_object_to_string(arg TSRMLS_CC); |
|
} |
|
} |
|
/* break missing intentionally */ |
|
case 'l': case 'd': |
case 'l': case 'd': |
case 'H': case 'b': | case 's': case 'b': |
case 'r': case 'a': |
case 'r': case 'a': |
case 'o': case 'O': |
case 'o': case 'O': |
case 'z': case 'Z': |
case 'z': case 'Z': |
case 'C': case 'h': |
case 'C': case 'h': |
case 'f': case 'A': |
case 'f': case 'A': |
|
case 'H': case 'p': |
max_num_args++; |
max_num_args++; |
break; |
break; |
|
|
Line 717 static int zend_parse_va_args(int num_args, char *type
|
Line 739 static int zend_parse_va_args(int num_args, char *type
|
if (have_varargs) { |
if (have_varargs) { |
if (!quiet) { |
if (!quiet) { |
zend_function *active_function = EG(current_execute_data)->function_state.function; |
zend_function *active_function = EG(current_execute_data)->function_state.function; |
char *class_name = active_function->common.scope ? active_function->common.scope->name : ""; | const char *class_name = active_function->common.scope ? active_function->common.scope->name : ""; |
zend_error(E_WARNING, "%s%s%s(): only one varargs specifier (* or +) is permitted", |
zend_error(E_WARNING, "%s%s%s(): only one varargs specifier (* or +) is permitted", |
class_name, |
class_name, |
class_name[0] ? "::" : "", |
class_name[0] ? "::" : "", |
Line 737 static int zend_parse_va_args(int num_args, char *type
|
Line 759 static int zend_parse_va_args(int num_args, char *type
|
default: |
default: |
if (!quiet) { |
if (!quiet) { |
zend_function *active_function = EG(current_execute_data)->function_state.function; |
zend_function *active_function = EG(current_execute_data)->function_state.function; |
char *class_name = active_function->common.scope ? active_function->common.scope->name : ""; | const char *class_name = active_function->common.scope ? active_function->common.scope->name : ""; |
zend_error(E_WARNING, "%s%s%s(): bad type specifier while parsing parameters", |
zend_error(E_WARNING, "%s%s%s(): bad type specifier while parsing parameters", |
class_name, |
class_name, |
class_name[0] ? "::" : "", |
class_name[0] ? "::" : "", |
Line 760 static int zend_parse_va_args(int num_args, char *type
|
Line 782 static int zend_parse_va_args(int num_args, char *type
|
if (num_args < min_num_args || (num_args > max_num_args && max_num_args > 0)) { |
if (num_args < min_num_args || (num_args > max_num_args && max_num_args > 0)) { |
if (!quiet) { |
if (!quiet) { |
zend_function *active_function = EG(current_execute_data)->function_state.function; |
zend_function *active_function = EG(current_execute_data)->function_state.function; |
char *class_name = active_function->common.scope ? active_function->common.scope->name : ""; | const char *class_name = active_function->common.scope ? active_function->common.scope->name : ""; |
zend_error(E_WARNING, "%s%s%s() expects %s %d parameter%s, %d given", |
zend_error(E_WARNING, "%s%s%s() expects %s %d parameter%s, %d given", |
class_name, |
class_name, |
class_name[0] ? "::" : "", |
class_name[0] ? "::" : "", |
Line 773 static int zend_parse_va_args(int num_args, char *type
|
Line 795 static int zend_parse_va_args(int num_args, char *type
|
return FAILURE; |
return FAILURE; |
} |
} |
|
|
|
arg_count = (int)(zend_uintptr_t) *(zend_vm_stack_top(TSRMLS_C) - 1); |
|
|
if (num_args > arg_count) { |
if (num_args > arg_count) { |
zend_error(E_WARNING, "%s(): could not obtain parameters for parsing", |
zend_error(E_WARNING, "%s(): could not obtain parameters for parsing", |
get_active_function_name(TSRMLS_C)); |
get_active_function_name(TSRMLS_C)); |
Line 836 static int zend_parse_va_args(int num_args, char *type
|
Line 860 static int zend_parse_va_args(int num_args, char *type
|
int __num_args = (num_args); \ |
int __num_args = (num_args); \ |
\ |
\ |
if (0 == (type_spec)[0] && 0 != __num_args && !(quiet)) { \ |
if (0 == (type_spec)[0] && 0 != __num_args && !(quiet)) { \ |
char *__space; \ | const char *__space; \ |
char * __class_name = get_active_class_name(&__space TSRMLS_CC); \ | const char * __class_name = get_active_class_name(&__space TSRMLS_CC); \ |
zend_error(E_WARNING, "%s%s%s() expects exactly 0 parameters, %d given", \ |
zend_error(E_WARNING, "%s%s%s() expects exactly 0 parameters, %d given", \ |
__class_name, __space, \ |
__class_name, __space, \ |
get_active_function_name(TSRMLS_C), __num_args); \ |
get_active_function_name(TSRMLS_C), __num_args); \ |
Line 845 static int zend_parse_va_args(int num_args, char *type
|
Line 869 static int zend_parse_va_args(int num_args, char *type
|
}\ |
}\ |
} |
} |
|
|
ZEND_API int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, char *type_spec, ...) /* {{{ */ | ZEND_API int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, const char *type_spec, ...) /* {{{ */ |
{ |
{ |
va_list va; |
va_list va; |
int retval; |
int retval; |
Line 860 ZEND_API int zend_parse_parameters_ex(int flags, int n
|
Line 884 ZEND_API int zend_parse_parameters_ex(int flags, int n
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...) /* {{{ */ | ZEND_API int zend_parse_parameters(int num_args TSRMLS_DC, const char *type_spec, ...) /* {{{ */ |
{ |
{ |
va_list va; |
va_list va; |
int retval; |
int retval; |
Line 875 ZEND_API int zend_parse_parameters(int num_args TSRMLS
|
Line 899 ZEND_API int zend_parse_parameters(int num_args TSRMLS
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API int zend_parse_method_parameters(int num_args TSRMLS_DC, zval *this_ptr, char *type_spec, ...) /* {{{ */ | ZEND_API int zend_parse_method_parameters(int num_args TSRMLS_DC, zval *this_ptr, const char *type_spec, ...) /* {{{ */ |
{ |
{ |
va_list va; |
va_list va; |
int retval; |
int retval; |
char *p = type_spec; | const char *p = type_spec; |
zval **object; |
zval **object; |
zend_class_entry *ce; |
zend_class_entry *ce; |
|
|
Line 911 ZEND_API int zend_parse_method_parameters(int num_args
|
Line 935 ZEND_API int zend_parse_method_parameters(int num_args
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC, zval *this_ptr, char *type_spec, ...) /* {{{ */ | ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC, zval *this_ptr, const char *type_spec, ...) /* {{{ */ |
{ |
{ |
va_list va; |
va_list va; |
int retval; |
int retval; |
char *p = type_spec; | const char *p = type_spec; |
zval **object; |
zval **object; |
zend_class_entry *ce; |
zend_class_entry *ce; |
int quiet = flags & ZEND_PARSE_PARAMS_QUIET; |
int quiet = flags & ZEND_PARSE_PARAMS_QUIET; |
Line 973 static int zend_merge_property(zval **value TSRMLS_DC,
|
Line 997 static int zend_merge_property(zval **value TSRMLS_DC,
|
|
|
MAKE_STD_ZVAL(member); |
MAKE_STD_ZVAL(member); |
ZVAL_STRINGL(member, hash_key->arKey, hash_key->nKeyLength-1, 1); |
ZVAL_STRINGL(member, hash_key->arKey, hash_key->nKeyLength-1, 1); |
obj_ht->write_property(obj, member, *value TSRMLS_CC); | obj_ht->write_property(obj, member, *value, 0 TSRMLS_CC); |
zval_ptr_dtor(&member); |
zval_ptr_dtor(&member); |
} |
} |
return ZEND_HASH_APPLY_KEEP; |
return ZEND_HASH_APPLY_KEEP; |
Line 984 static int zend_merge_property(zval **value TSRMLS_DC,
|
Line 1008 static int zend_merge_property(zval **value TSRMLS_DC,
|
* because it may call __set from the uninitialized object otherwise. */ |
* because it may call __set from the uninitialized object otherwise. */ |
ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destroy_ht TSRMLS_DC) /* {{{ */ |
ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destroy_ht TSRMLS_DC) /* {{{ */ |
{ |
{ |
zend_object_handlers *obj_ht = Z_OBJ_HT_P(obj); | const zend_object_handlers *obj_ht = Z_OBJ_HT_P(obj); |
zend_class_entry *old_scope = EG(scope); |
zend_class_entry *old_scope = EG(scope); |
|
|
EG(scope) = Z_OBJCE_P(obj); |
EG(scope) = Z_OBJCE_P(obj); |
Line 998 ZEND_API void zend_merge_properties(zval *obj, HashTab
|
Line 1022 ZEND_API void zend_merge_properties(zval *obj, HashTab
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
|
static int zval_update_class_constant(zval **pp, int is_static, int offset TSRMLS_DC) /* {{{ */ |
|
{ |
|
if ((Z_TYPE_PP(pp) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT || |
|
(Z_TYPE_PP(pp) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT_ARRAY) { |
|
zend_class_entry **scope = EG(in_execution)?&EG(scope):&CG(active_class_entry); |
|
|
|
if ((*scope)->parent) { |
|
zend_class_entry *ce = *scope; |
|
HashPosition pos; |
|
zend_property_info *prop_info; |
|
|
|
do { |
|
for (zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos); |
|
zend_hash_get_current_data_ex(&ce->properties_info, (void **) &prop_info, &pos) == SUCCESS; |
|
zend_hash_move_forward_ex(&ce->properties_info, &pos)) { |
|
if (is_static == ((prop_info->flags & ZEND_ACC_STATIC) != 0) && |
|
offset == prop_info->offset) { |
|
int ret; |
|
zend_class_entry *old_scope = *scope; |
|
*scope = prop_info->ce; |
|
ret = zval_update_constant(pp, (void*)1 TSRMLS_CC); |
|
*scope = old_scope; |
|
return ret; |
|
} |
|
} |
|
ce = ce->parent; |
|
} while (ce); |
|
|
|
} |
|
return zval_update_constant(pp, (void*)1 TSRMLS_CC); |
|
} |
|
return 0; |
|
} |
|
/* }}} */ |
|
|
ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ |
ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ |
{ |
{ |
if (!class_type->constants_updated || !CE_STATIC_MEMBERS(class_type)) { | if ((class_type->ce_flags & ZEND_ACC_CONSTANTS_UPDATED) == 0 || (!CE_STATIC_MEMBERS(class_type) && class_type->default_static_members_count)) { |
zend_class_entry **scope = EG(in_execution)?&EG(scope):&CG(active_class_entry); |
zend_class_entry **scope = EG(in_execution)?&EG(scope):&CG(active_class_entry); |
zend_class_entry *old_scope = *scope; |
zend_class_entry *old_scope = *scope; |
|
int i; |
|
|
*scope = class_type; |
*scope = class_type; |
zend_hash_apply_with_argument(&class_type->constants_table, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC); |
zend_hash_apply_with_argument(&class_type->constants_table, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC); |
zend_hash_apply_with_argument(&class_type->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC); |
|
|
|
if (!CE_STATIC_MEMBERS(class_type)) { | for (i = 0; i < class_type->default_properties_count; i++) { |
HashPosition pos; | if (class_type->default_properties_table[i]) { |
| zval_update_class_constant(&class_type->default_properties_table[i], 0, i TSRMLS_CC); |
| } |
| } |
| |
| if (!CE_STATIC_MEMBERS(class_type) && class_type->default_static_members_count) { |
zval **p; |
zval **p; |
|
|
if (class_type->parent) { |
if (class_type->parent) { |
zend_update_class_constants(class_type->parent TSRMLS_CC); |
zend_update_class_constants(class_type->parent TSRMLS_CC); |
} |
} |
#if ZTS |
#if ZTS |
ALLOC_HASHTABLE(CG(static_members)[(zend_intptr_t)(class_type->static_members)]); | CG(static_members_table)[(zend_intptr_t)(class_type->static_members_table)] = emalloc(sizeof(zval*) * class_type->default_static_members_count); |
#else |
#else |
ALLOC_HASHTABLE(class_type->static_members); | class_type->static_members_table = emalloc(sizeof(zval*) * class_type->default_static_members_count); |
#endif |
#endif |
zend_hash_init(CE_STATIC_MEMBERS(class_type), zend_hash_num_elements(&class_type->default_static_members), NULL, ZVAL_PTR_DTOR, 0); | for (i = 0; i < class_type->default_static_members_count; i++) { |
| p = &class_type->default_static_members_table[i]; |
zend_hash_internal_pointer_reset_ex(&class_type->default_static_members, &pos); | |
while (zend_hash_get_current_data_ex(&class_type->default_static_members, (void**)&p, &pos) == SUCCESS) { | |
char *str_index; | |
uint str_length; | |
ulong num_index; | |
zval **q; | |
| |
zend_hash_get_current_key_ex(&class_type->default_static_members, &str_index, &str_length, &num_index, 0, &pos); | |
if (Z_ISREF_PP(p) && |
if (Z_ISREF_PP(p) && |
class_type->parent && |
class_type->parent && |
zend_hash_find(&class_type->parent->default_static_members, str_index, str_length, (void**)&q) == SUCCESS && | i < class_type->parent->default_static_members_count && |
*p == *q && | *p == class_type->parent->default_static_members_table[i] && |
zend_hash_find(CE_STATIC_MEMBERS(class_type->parent), str_index, str_length, (void**)&q) == SUCCESS | CE_STATIC_MEMBERS(class_type->parent)[i] |
) { |
) { |
Z_ADDREF_PP(q); | zval *q = CE_STATIC_MEMBERS(class_type->parent)[i]; |
Z_SET_ISREF_PP(q); | |
zend_hash_add(CE_STATIC_MEMBERS(class_type), str_index, str_length, (void**)q, sizeof(zval*), NULL); | Z_ADDREF_P(q); |
| Z_SET_ISREF_P(q); |
| CE_STATIC_MEMBERS(class_type)[i] = q; |
} else { |
} else { |
zval *r; |
zval *r; |
|
|
Line 1046 ZEND_API void zend_update_class_constants(zend_class_e
|
Line 1104 ZEND_API void zend_update_class_constants(zend_class_e
|
*r = **p; |
*r = **p; |
INIT_PZVAL(r); |
INIT_PZVAL(r); |
zval_copy_ctor(r); |
zval_copy_ctor(r); |
zend_hash_add(CE_STATIC_MEMBERS(class_type), str_index, str_length, (void**)&r, sizeof(zval*), NULL); | CE_STATIC_MEMBERS(class_type)[i] = r; |
} |
} |
zend_hash_move_forward_ex(&class_type->default_static_members, &pos); |
|
} |
} |
} |
} |
zend_hash_apply_with_argument(CE_STATIC_MEMBERS(class_type), (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC); |
|
|
|
|
for (i = 0; i < class_type->default_static_members_count; i++) { |
|
zval_update_class_constant(&CE_STATIC_MEMBERS(class_type)[i], 1, i TSRMLS_CC); |
|
} |
|
|
*scope = old_scope; |
*scope = old_scope; |
class_type->constants_updated = 1; | class_type->ce_flags |= ZEND_ACC_CONSTANTS_UPDATED; |
} |
} |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
|
ZEND_API void object_properties_init(zend_object *object, zend_class_entry *class_type) /* {{{ */ |
|
{ |
|
int i; |
|
|
|
if (class_type->default_properties_count) { |
|
object->properties_table = emalloc(sizeof(zval*) * class_type->default_properties_count); |
|
for (i = 0; i < class_type->default_properties_count; i++) { |
|
object->properties_table[i] = class_type->default_properties_table[i]; |
|
if (class_type->default_properties_table[i]) { |
|
#if ZTS |
|
ALLOC_ZVAL( object->properties_table[i]); |
|
MAKE_COPY_ZVAL(&class_type->default_properties_table[i], object->properties_table[i]); |
|
#else |
|
Z_ADDREF_P(object->properties_table[i]); |
|
#endif |
|
} |
|
} |
|
object->properties = NULL; |
|
} |
|
} |
|
/* }}} */ |
|
|
/* This function requires 'properties' to contain all props declared in the |
/* This function requires 'properties' to contain all props declared in the |
* class and all props being public. If only a subset is given or the class |
* class and all props being public. If only a subset is given or the class |
* has protected members then you need to merge the properties seperately by | * has protected members then you need to merge the properties separately by |
* calling zend_merge_properties(). */ |
* calling zend_merge_properties(). */ |
ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties ZEND_FILE_LINE_DC TSRMLS_DC) /* {{{ */ |
ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties ZEND_FILE_LINE_DC TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *tmp; |
|
zend_object *object; |
zend_object *object; |
|
|
if (class_type->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) { |
if (class_type->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) { |
char *what = class_type->ce_flags & ZEND_ACC_INTERFACE ? "interface" : "abstract class"; | char *what = (class_type->ce_flags & ZEND_ACC_INTERFACE) ? "interface" |
| :((class_type->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) ? "trait" |
| : "abstract class"; |
zend_error(E_ERROR, "Cannot instantiate %s %s", what, class_type->name); |
zend_error(E_ERROR, "Cannot instantiate %s %s", what, class_type->name); |
} |
} |
|
|
Line 1080 ZEND_API int _object_and_properties_init(zval *arg, ze
|
Line 1163 ZEND_API int _object_and_properties_init(zval *arg, ze
|
Z_OBJVAL_P(arg) = zend_objects_new(&object, class_type TSRMLS_CC); |
Z_OBJVAL_P(arg) = zend_objects_new(&object, class_type TSRMLS_CC); |
if (properties) { |
if (properties) { |
object->properties = properties; |
object->properties = properties; |
|
object->properties_table = NULL; |
} else { |
} else { |
ALLOC_HASHTABLE_REL(object->properties); | object_properties_init(object, class_type); |
zend_hash_init(object->properties, zend_hash_num_elements(&class_type->default_properties), NULL, ZVAL_PTR_DTOR, 0); | |
zend_hash_copy(object->properties, &class_type->default_properties, zval_copy_property_ctor(class_type), (void *) &tmp, sizeof(zval *)); | |
} |
} |
} else { |
} else { |
Z_OBJVAL_P(arg) = class_type->create_object(class_type TSRMLS_CC); |
Z_OBJVAL_P(arg) = class_type->create_object(class_type TSRMLS_CC); |
Line 1437 ZEND_API int add_property_long_ex(zval *arg, const cha
|
Line 1519 ZEND_API int add_property_long_ex(zval *arg, const cha
|
MAKE_STD_ZVAL(z_key); |
MAKE_STD_ZVAL(z_key); |
ZVAL_STRINGL(z_key, key, key_len-1, 1); |
ZVAL_STRINGL(z_key, key, key_len-1, 1); |
|
|
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC); | Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC); |
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ |
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ |
zval_ptr_dtor(&z_key); |
zval_ptr_dtor(&z_key); |
return SUCCESS; |
return SUCCESS; |
Line 1455 ZEND_API int add_property_bool_ex(zval *arg, const cha
|
Line 1537 ZEND_API int add_property_bool_ex(zval *arg, const cha
|
MAKE_STD_ZVAL(z_key); |
MAKE_STD_ZVAL(z_key); |
ZVAL_STRINGL(z_key, key, key_len-1, 1); |
ZVAL_STRINGL(z_key, key, key_len-1, 1); |
|
|
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC); | Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC); |
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ |
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ |
zval_ptr_dtor(&z_key); |
zval_ptr_dtor(&z_key); |
return SUCCESS; |
return SUCCESS; |
Line 1473 ZEND_API int add_property_null_ex(zval *arg, const cha
|
Line 1555 ZEND_API int add_property_null_ex(zval *arg, const cha
|
MAKE_STD_ZVAL(z_key); |
MAKE_STD_ZVAL(z_key); |
ZVAL_STRINGL(z_key, key, key_len-1, 1); |
ZVAL_STRINGL(z_key, key, key_len-1, 1); |
|
|
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC); | Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC); |
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ |
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ |
zval_ptr_dtor(&z_key); |
zval_ptr_dtor(&z_key); |
return SUCCESS; |
return SUCCESS; |
Line 1491 ZEND_API int add_property_resource_ex(zval *arg, const
|
Line 1573 ZEND_API int add_property_resource_ex(zval *arg, const
|
MAKE_STD_ZVAL(z_key); |
MAKE_STD_ZVAL(z_key); |
ZVAL_STRINGL(z_key, key, key_len-1, 1); |
ZVAL_STRINGL(z_key, key, key_len-1, 1); |
|
|
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC); | Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC); |
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ |
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ |
zval_ptr_dtor(&z_key); |
zval_ptr_dtor(&z_key); |
return SUCCESS; |
return SUCCESS; |
Line 1509 ZEND_API int add_property_double_ex(zval *arg, const c
|
Line 1591 ZEND_API int add_property_double_ex(zval *arg, const c
|
MAKE_STD_ZVAL(z_key); |
MAKE_STD_ZVAL(z_key); |
ZVAL_STRINGL(z_key, key, key_len-1, 1); |
ZVAL_STRINGL(z_key, key, key_len-1, 1); |
|
|
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC); | Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC); |
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ |
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ |
zval_ptr_dtor(&z_key); |
zval_ptr_dtor(&z_key); |
return SUCCESS; |
return SUCCESS; |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate TSRMLS_DC) /* {{{ */ | ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *tmp; |
zval *tmp; |
zval *z_key; |
zval *z_key; |
Line 1527 ZEND_API int add_property_string_ex(zval *arg, const c
|
Line 1609 ZEND_API int add_property_string_ex(zval *arg, const c
|
MAKE_STD_ZVAL(z_key); |
MAKE_STD_ZVAL(z_key); |
ZVAL_STRINGL(z_key, key, key_len-1, 1); |
ZVAL_STRINGL(z_key, key, key_len-1, 1); |
|
|
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC); | Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC); |
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ |
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ |
zval_ptr_dtor(&z_key); |
zval_ptr_dtor(&z_key); |
return SUCCESS; |
return SUCCESS; |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC) /* {{{ */ | ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, int duplicate TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *tmp; |
zval *tmp; |
zval *z_key; |
zval *z_key; |
Line 1545 ZEND_API int add_property_stringl_ex(zval *arg, const
|
Line 1627 ZEND_API int add_property_stringl_ex(zval *arg, const
|
MAKE_STD_ZVAL(z_key); |
MAKE_STD_ZVAL(z_key); |
ZVAL_STRINGL(z_key, key, key_len-1, 1); |
ZVAL_STRINGL(z_key, key, key_len-1, 1); |
|
|
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC); | Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC); |
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ |
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ |
zval_ptr_dtor(&z_key); |
zval_ptr_dtor(&z_key); |
return SUCCESS; |
return SUCCESS; |
Line 1559 ZEND_API int add_property_zval_ex(zval *arg, const cha
|
Line 1641 ZEND_API int add_property_zval_ex(zval *arg, const cha
|
MAKE_STD_ZVAL(z_key); |
MAKE_STD_ZVAL(z_key); |
ZVAL_STRINGL(z_key, key, key_len-1, 1); |
ZVAL_STRINGL(z_key, key, key_len-1, 1); |
|
|
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, value TSRMLS_CC); | Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, value, 0 TSRMLS_CC); |
zval_ptr_dtor(&z_key); |
zval_ptr_dtor(&z_key); |
return SUCCESS; |
return SUCCESS; |
} |
} |
Line 1657 try_again:
|
Line 1739 try_again:
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
|
ZEND_API void zend_collect_module_handlers(TSRMLS_D) /* {{{ */ |
|
{ |
|
HashPosition pos; |
|
zend_module_entry *module; |
|
int startup_count = 0; |
|
int shutdown_count = 0; |
|
int post_deactivate_count = 0; |
|
zend_class_entry **pce; |
|
int class_count = 0; |
|
|
|
/* Collect extensions with request startup/shutdown handlers */ |
|
for (zend_hash_internal_pointer_reset_ex(&module_registry, &pos); |
|
zend_hash_get_current_data_ex(&module_registry, (void *) &module, &pos) == SUCCESS; |
|
zend_hash_move_forward_ex(&module_registry, &pos)) { |
|
if (module->request_startup_func) { |
|
startup_count++; |
|
} |
|
if (module->request_shutdown_func) { |
|
shutdown_count++; |
|
} |
|
if (module->post_deactivate_func) { |
|
post_deactivate_count++; |
|
} |
|
} |
|
module_request_startup_handlers = (zend_module_entry**)malloc( |
|
sizeof(zend_module_entry*) * |
|
(startup_count + 1 + |
|
shutdown_count + 1 + |
|
post_deactivate_count + 1)); |
|
module_request_startup_handlers[startup_count] = NULL; |
|
module_request_shutdown_handlers = module_request_startup_handlers + startup_count + 1; |
|
module_request_shutdown_handlers[shutdown_count] = NULL; |
|
module_post_deactivate_handlers = module_request_shutdown_handlers + shutdown_count + 1; |
|
module_post_deactivate_handlers[post_deactivate_count] = NULL; |
|
startup_count = 0; |
|
|
|
for (zend_hash_internal_pointer_reset_ex(&module_registry, &pos); |
|
zend_hash_get_current_data_ex(&module_registry, (void *) &module, &pos) == SUCCESS; |
|
zend_hash_move_forward_ex(&module_registry, &pos)) { |
|
if (module->request_startup_func) { |
|
module_request_startup_handlers[startup_count++] = module; |
|
} |
|
if (module->request_shutdown_func) { |
|
module_request_shutdown_handlers[--shutdown_count] = module; |
|
} |
|
if (module->post_deactivate_func) { |
|
module_post_deactivate_handlers[--post_deactivate_count] = module; |
|
} |
|
} |
|
|
|
/* Collect internal classes with static members */ |
|
for (zend_hash_internal_pointer_reset_ex(CG(class_table), &pos); |
|
zend_hash_get_current_data_ex(CG(class_table), (void *) &pce, &pos) == SUCCESS; |
|
zend_hash_move_forward_ex(CG(class_table), &pos)) { |
|
if ((*pce)->type == ZEND_INTERNAL_CLASS && |
|
(*pce)->default_static_members_count > 0) { |
|
class_count++; |
|
} |
|
} |
|
|
|
class_cleanup_handlers = (zend_class_entry**)malloc( |
|
sizeof(zend_class_entry*) * |
|
(class_count + 1)); |
|
class_cleanup_handlers[class_count] = NULL; |
|
|
|
if (class_count) { |
|
for (zend_hash_internal_pointer_reset_ex(CG(class_table), &pos); |
|
zend_hash_get_current_data_ex(CG(class_table), (void *) &pce, &pos) == SUCCESS; |
|
zend_hash_move_forward_ex(CG(class_table), &pos)) { |
|
if ((*pce)->type == ZEND_INTERNAL_CLASS && |
|
(*pce)->default_static_members_count > 0) { |
|
class_cleanup_handlers[--class_count] = *pce; |
|
} |
|
} |
|
} |
|
} |
|
/* }}} */ |
|
|
ZEND_API int zend_startup_modules(TSRMLS_D) /* {{{ */ |
ZEND_API int zend_startup_modules(TSRMLS_D) /* {{{ */ |
{ |
{ |
zend_hash_sort(&module_registry, zend_sort_modules, NULL, 0 TSRMLS_CC); |
zend_hash_sort(&module_registry, zend_sort_modules, NULL, 0 TSRMLS_CC); |
Line 1665 ZEND_API int zend_startup_modules(TSRMLS_D) /* {{{ */
|
Line 1825 ZEND_API int zend_startup_modules(TSRMLS_D) /* {{{ */
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
|
ZEND_API void zend_destroy_modules(void) /* {{{ */ |
|
{ |
|
free(class_cleanup_handlers); |
|
free(module_request_startup_handlers); |
|
zend_hash_graceful_reverse_destroy(&module_registry); |
|
} |
|
/* }}} */ |
|
|
ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TSRMLS_DC) /* {{{ */ |
ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TSRMLS_DC) /* {{{ */ |
{ |
{ |
int name_len; |
int name_len; |
Line 1798 ZEND_API int zend_register_functions(zend_class_entry
|
Line 1966 ZEND_API int zend_register_functions(zend_class_entry
|
const zend_function_entry *ptr = functions; |
const zend_function_entry *ptr = functions; |
zend_function function, *reg_function; |
zend_function function, *reg_function; |
zend_internal_function *internal_function = (zend_internal_function *)&function; |
zend_internal_function *internal_function = (zend_internal_function *)&function; |
int count=0, unload=0; | int count=0, unload=0, result=0; |
HashTable *target_function_table = function_table; |
HashTable *target_function_table = function_table; |
int error_type; |
int error_type; |
zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL, *__callstatic = NULL, *__tostring = NULL; |
zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL, *__callstatic = NULL, *__tostring = NULL; |
char *lowercase_name; | const char *lowercase_name; |
int fname_len; |
int fname_len; |
char *lc_class_name = NULL; | const char *lc_class_name = NULL; |
int class_name_len = 0; |
int class_name_len = 0; |
|
|
if (type==MODULE_PERSISTENT) { |
if (type==MODULE_PERSISTENT) { |
Line 1835 ZEND_API int zend_register_functions(zend_class_entry
|
Line 2003 ZEND_API int zend_register_functions(zend_class_entry
|
internal_function->function_name = (char*)ptr->fname; |
internal_function->function_name = (char*)ptr->fname; |
internal_function->scope = scope; |
internal_function->scope = scope; |
internal_function->prototype = NULL; |
internal_function->prototype = NULL; |
if (ptr->arg_info) { |
|
internal_function->arg_info = (zend_arg_info*)ptr->arg_info+1; |
|
internal_function->num_args = ptr->num_args; |
|
/* Currently you cannot denote that the function can accept less arguments than num_args */ |
|
if (ptr->arg_info[0].required_num_args == -1) { |
|
internal_function->required_num_args = ptr->num_args; |
|
} else { |
|
internal_function->required_num_args = ptr->arg_info[0].required_num_args; |
|
} |
|
internal_function->pass_rest_by_reference = ptr->arg_info[0].pass_by_reference; |
|
internal_function->return_reference = ptr->arg_info[0].return_reference; |
|
} else { |
|
internal_function->arg_info = NULL; |
|
internal_function->num_args = 0; |
|
internal_function->required_num_args = 0; |
|
internal_function->pass_rest_by_reference = 0; |
|
internal_function->return_reference = 0; |
|
} |
|
if (ptr->flags) { |
if (ptr->flags) { |
if (!(ptr->flags & ZEND_ACC_PPP_MASK)) { |
if (!(ptr->flags & ZEND_ACC_PPP_MASK)) { |
if (ptr->flags != ZEND_ACC_DEPRECATED || scope) { |
if (ptr->flags != ZEND_ACC_DEPRECATED || scope) { |
Line 1865 ZEND_API int zend_register_functions(zend_class_entry
|
Line 2015 ZEND_API int zend_register_functions(zend_class_entry
|
} else { |
} else { |
internal_function->fn_flags = ZEND_ACC_PUBLIC; |
internal_function->fn_flags = ZEND_ACC_PUBLIC; |
} |
} |
|
if (ptr->arg_info) { |
|
zend_internal_function_info *info = (zend_internal_function_info*)ptr->arg_info; |
|
|
|
internal_function->arg_info = (zend_arg_info*)ptr->arg_info+1; |
|
internal_function->num_args = ptr->num_args; |
|
/* Currently you cannot denote that the function can accept less arguments than num_args */ |
|
if (info->required_num_args == -1) { |
|
internal_function->required_num_args = ptr->num_args; |
|
} else { |
|
internal_function->required_num_args = info->required_num_args; |
|
} |
|
if (info->pass_rest_by_reference) { |
|
if (info->pass_rest_by_reference == ZEND_SEND_PREFER_REF) { |
|
internal_function->fn_flags |= ZEND_ACC_PASS_REST_PREFER_REF; |
|
} else { |
|
internal_function->fn_flags |= ZEND_ACC_PASS_REST_BY_REFERENCE; |
|
} |
|
} |
|
if (info->return_reference) { |
|
internal_function->fn_flags |= ZEND_ACC_RETURN_REFERENCE; |
|
} |
|
} else { |
|
internal_function->arg_info = NULL; |
|
internal_function->num_args = 0; |
|
internal_function->required_num_args = 0; |
|
} |
if (ptr->flags & ZEND_ACC_ABSTRACT) { |
if (ptr->flags & ZEND_ACC_ABSTRACT) { |
if (scope) { |
if (scope) { |
/* This is a class that must be abstract itself. Here we set the check info. */ |
/* This is a class that must be abstract itself. Here we set the check info. */ |
Line 1881 ZEND_API int zend_register_functions(zend_class_entry
|
Line 2057 ZEND_API int zend_register_functions(zend_class_entry
|
} |
} |
} else { |
} else { |
if (scope && (scope->ce_flags & ZEND_ACC_INTERFACE)) { |
if (scope && (scope->ce_flags & ZEND_ACC_INTERFACE)) { |
efree(lc_class_name); | efree((char*)lc_class_name); |
zend_error(error_type, "Interface %s cannot contain non abstract method %s()", scope->name, ptr->fname); |
zend_error(error_type, "Interface %s cannot contain non abstract method %s()", scope->name, ptr->fname); |
return FAILURE; |
return FAILURE; |
} |
} |
if (!internal_function->handler) { |
if (!internal_function->handler) { |
if (scope) { |
if (scope) { |
efree(lc_class_name); | efree((char*)lc_class_name); |
} |
} |
zend_error(error_type, "Method %s%s%s() cannot be a NULL function", scope ? scope->name : "", scope ? "::" : "", ptr->fname); |
zend_error(error_type, "Method %s%s%s() cannot be a NULL function", scope ? scope->name : "", scope ? "::" : "", ptr->fname); |
zend_unregister_functions(functions, count, target_function_table TSRMLS_CC); |
zend_unregister_functions(functions, count, target_function_table TSRMLS_CC); |
Line 1895 ZEND_API int zend_register_functions(zend_class_entry
|
Line 2071 ZEND_API int zend_register_functions(zend_class_entry
|
} |
} |
} |
} |
fname_len = strlen(ptr->fname); |
fname_len = strlen(ptr->fname); |
lowercase_name = zend_str_tolower_dup(ptr->fname, fname_len); | lowercase_name = zend_new_interned_string(zend_str_tolower_dup(ptr->fname, fname_len), fname_len + 1, 1 TSRMLS_CC); |
if (zend_hash_add(target_function_table, lowercase_name, fname_len+1, &function, sizeof(zend_function), (void**)®_function) == FAILURE) { | if (IS_INTERNED(lowercase_name)) { |
| result = zend_hash_quick_add(target_function_table, lowercase_name, fname_len+1, INTERNED_HASH(lowercase_name), &function, sizeof(zend_function), (void**)®_function); |
| } else { |
| result = zend_hash_add(target_function_table, lowercase_name, fname_len+1, &function, sizeof(zend_function), (void**)®_function); |
| } |
| if (result == FAILURE) { |
unload=1; |
unload=1; |
efree(lowercase_name); | str_efree(lowercase_name); |
break; |
break; |
} |
} |
if (scope) { |
if (scope) { |
Line 1906 ZEND_API int zend_register_functions(zend_class_entry
|
Line 2087 ZEND_API int zend_register_functions(zend_class_entry
|
* 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 |
* a constructor already. |
* a constructor already. |
*/ |
*/ |
if ((fname_len == class_name_len) && !memcmp(lowercase_name, lc_class_name, class_name_len+1) && !ctor) { | if ((fname_len == class_name_len) && !ctor && !memcmp(lowercase_name, lc_class_name, class_name_len+1)) { |
ctor = reg_function; |
ctor = reg_function; |
} else if ((fname_len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME))) { |
} else if ((fname_len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME))) { |
ctor = reg_function; |
ctor = reg_function; |
Line 1940 ZEND_API int zend_register_functions(zend_class_entry
|
Line 2121 ZEND_API int zend_register_functions(zend_class_entry
|
} |
} |
ptr++; |
ptr++; |
count++; |
count++; |
efree(lowercase_name); | str_efree(lowercase_name); |
} |
} |
if (unload) { /* before unloading, display all remaining bad function in the module */ |
if (unload) { /* before unloading, display all remaining bad function in the module */ |
if (scope) { |
if (scope) { |
efree(lc_class_name); | efree((char*)lc_class_name); |
} |
} |
while (ptr->fname) { |
while (ptr->fname) { |
fname_len = strlen(ptr->fname); |
fname_len = strlen(ptr->fname); |
Line 1952 ZEND_API int zend_register_functions(zend_class_entry
|
Line 2133 ZEND_API int zend_register_functions(zend_class_entry
|
if (zend_hash_exists(target_function_table, lowercase_name, fname_len+1)) { |
if (zend_hash_exists(target_function_table, lowercase_name, fname_len+1)) { |
zend_error(error_type, "Function registration failed - duplicate name - %s%s%s", scope ? scope->name : "", scope ? "::" : "", ptr->fname); |
zend_error(error_type, "Function registration failed - duplicate name - %s%s%s", scope ? scope->name : "", scope ? "::" : "", ptr->fname); |
} |
} |
efree(lowercase_name); | efree((char*)lowercase_name); |
ptr++; |
ptr++; |
} |
} |
zend_unregister_functions(functions, count, target_function_table TSRMLS_CC); |
zend_unregister_functions(functions, count, target_function_table TSRMLS_CC); |
Line 2032 ZEND_API int zend_register_functions(zend_class_entry
|
Line 2213 ZEND_API int zend_register_functions(zend_class_entry
|
} |
} |
__isset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; |
__isset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; |
} |
} |
efree(lc_class_name); | efree((char*)lc_class_name); |
} |
} |
return SUCCESS; |
return SUCCESS; |
} |
} |
Line 2085 ZEND_API int zend_get_module_started(const char *modul
|
Line 2266 ZEND_API int zend_get_module_started(const char *modul
|
|
|
static int clean_module_class(const zend_class_entry **ce, int *module_number TSRMLS_DC) /* {{{ */ |
static int clean_module_class(const zend_class_entry **ce, int *module_number TSRMLS_DC) /* {{{ */ |
{ |
{ |
if ((*ce)->type == ZEND_INTERNAL_CLASS && (*ce)->module->module_number == *module_number) { | if ((*ce)->type == ZEND_INTERNAL_CLASS && (*ce)->info.internal.module->module_number == *module_number) { |
return ZEND_HASH_APPLY_REMOVE; |
return ZEND_HASH_APPLY_REMOVE; |
} else { |
} else { |
return ZEND_HASH_APPLY_KEEP; |
return ZEND_HASH_APPLY_KEEP; |
Line 2119 void module_destructor(zend_module_entry *module) /* {
|
Line 2300 void module_destructor(zend_module_entry *module) /* {
|
/* Deinitilaise module globals */ |
/* Deinitilaise module globals */ |
if (module->globals_size) { |
if (module->globals_size) { |
#ifdef ZTS |
#ifdef ZTS |
ts_free_id(*module->globals_id_ptr); | if (*module->globals_id_ptr) { |
| ts_free_id(*module->globals_id_ptr); |
| } |
#else |
#else |
if (module->globals_dtor) { |
if (module->globals_dtor) { |
module->globals_dtor(module->globals_ptr TSRMLS_CC); |
module->globals_dtor(module->globals_ptr TSRMLS_CC); |
Line 2134 void module_destructor(zend_module_entry *module) /* {
|
Line 2317 void module_destructor(zend_module_entry *module) /* {
|
|
|
#if HAVE_LIBDL |
#if HAVE_LIBDL |
#if !(defined(NETWARE) && defined(APACHE_1_BUILD)) |
#if !(defined(NETWARE) && defined(APACHE_1_BUILD)) |
if (module->handle) { | if (module->handle && !getenv("ZEND_DONT_UNLOAD_MODULES")) { |
DL_UNLOAD(module->handle); |
DL_UNLOAD(module->handle); |
} |
} |
#endif |
#endif |
Line 2142 void module_destructor(zend_module_entry *module) /* {
|
Line 2325 void module_destructor(zend_module_entry *module) /* {
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
/* call request startup for all modules */ | void zend_activate_modules(TSRMLS_D) /* {{{ */ |
int module_registry_request_startup(zend_module_entry *module TSRMLS_DC) /* {{{ */ | |
{ |
{ |
if (module->request_startup_func) { | zend_module_entry **p = module_request_startup_handlers; |
#if 0 | |
zend_printf("%s: Request startup\n", module->name); | while (*p) { |
#endif | zend_module_entry *module = *p; |
| |
if (module->request_startup_func(module->type, module->module_number TSRMLS_CC)==FAILURE) { |
if (module->request_startup_func(module->type, module->module_number TSRMLS_CC)==FAILURE) { |
zend_error(E_WARNING, "request_startup() for %s module failed", module->name); |
zend_error(E_WARNING, "request_startup() for %s module failed", module->name); |
exit(1); |
exit(1); |
} |
} |
|
p++; |
} |
} |
return 0; |
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
Line 2171 int module_registry_cleanup(zend_module_entry *module
|
Line 2354 int module_registry_cleanup(zend_module_entry *module
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
|
void zend_deactivate_modules(TSRMLS_D) /* {{{ */ |
|
{ |
|
EG(opline_ptr) = NULL; /* we're no longer executing anything */ |
|
|
|
zend_try { |
|
if (EG(full_tables_cleanup)) { |
|
zend_hash_reverse_apply(&module_registry, (apply_func_t) module_registry_cleanup TSRMLS_CC); |
|
} else { |
|
zend_module_entry **p = module_request_shutdown_handlers; |
|
|
|
while (*p) { |
|
zend_module_entry *module = *p; |
|
|
|
module->request_shutdown_func(module->type, module->module_number TSRMLS_CC); |
|
p++; |
|
} |
|
} |
|
} zend_end_try(); |
|
} |
|
/* }}} */ |
|
|
|
ZEND_API void zend_cleanup_internal_classes(TSRMLS_D) /* {{{ */ |
|
{ |
|
zend_class_entry **p = class_cleanup_handlers; |
|
|
|
while (*p) { |
|
zend_cleanup_internal_class_data(*p TSRMLS_CC); |
|
p++; |
|
} |
|
} |
|
/* }}} */ |
|
|
int module_registry_unload_temp(const zend_module_entry *module TSRMLS_DC) /* {{{ */ |
int module_registry_unload_temp(const zend_module_entry *module TSRMLS_DC) /* {{{ */ |
{ |
{ |
return (module->type == MODULE_TEMPORARY) ? ZEND_HASH_APPLY_REMOVE : ZEND_HASH_APPLY_STOP; |
return (module->type == MODULE_TEMPORARY) ? ZEND_HASH_APPLY_REMOVE : ZEND_HASH_APPLY_STOP; |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
|
static int exec_done_cb(zend_module_entry *module TSRMLS_DC) /* {{{ */ |
|
{ |
|
if (module->post_deactivate_func) { |
|
module->post_deactivate_func(); |
|
} |
|
return 0; |
|
} |
|
/* }}} */ |
|
|
|
void zend_post_deactivate_modules(TSRMLS_D) /* {{{ */ |
|
{ |
|
if (EG(full_tables_cleanup)) { |
|
zend_hash_apply(&module_registry, (apply_func_t) exec_done_cb TSRMLS_CC); |
|
zend_hash_reverse_apply(&module_registry, (apply_func_t) module_registry_unload_temp TSRMLS_CC); |
|
} else { |
|
zend_module_entry **p = module_post_deactivate_handlers; |
|
|
|
while (*p) { |
|
zend_module_entry *module = *p; |
|
|
|
module->post_deactivate_func(); |
|
p++; |
|
} |
|
} |
|
} |
|
/* }}} */ |
|
|
/* return the next free module number */ |
/* return the next free module number */ |
int zend_next_free_module(void) /* {{{ */ |
int zend_next_free_module(void) /* {{{ */ |
{ |
{ |
return ++module_count; | return zend_hash_num_elements(&module_registry) + 1; |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class_entry, zend_uint ce_flags TSRMLS_DC) /* {{{ */ |
static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class_entry, zend_uint ce_flags TSRMLS_DC) /* {{{ */ |
{ |
{ |
zend_class_entry *class_entry = malloc(sizeof(zend_class_entry)); |
zend_class_entry *class_entry = malloc(sizeof(zend_class_entry)); |
char *lowercase_name = malloc(orig_class_entry->name_length + 1); | char *lowercase_name = emalloc(orig_class_entry->name_length + 1); |
*class_entry = *orig_class_entry; |
*class_entry = *orig_class_entry; |
|
|
class_entry->type = ZEND_INTERNAL_CLASS; |
class_entry->type = ZEND_INTERNAL_CLASS; |
zend_initialize_class_data(class_entry, 0 TSRMLS_CC); |
zend_initialize_class_data(class_entry, 0 TSRMLS_CC); |
class_entry->ce_flags = ce_flags; |
class_entry->ce_flags = ce_flags; |
class_entry->module = EG(current_module); | class_entry->info.internal.module = EG(current_module); |
|
|
if (class_entry->builtin_functions) { | if (class_entry->info.internal.builtin_functions) { |
zend_register_functions(class_entry, class_entry->builtin_functions, &class_entry->function_table, MODULE_PERSISTENT TSRMLS_CC); | zend_register_functions(class_entry, class_entry->info.internal.builtin_functions, &class_entry->function_table, MODULE_PERSISTENT TSRMLS_CC); |
} |
} |
|
|
zend_str_tolower_copy(lowercase_name, orig_class_entry->name, class_entry->name_length); |
zend_str_tolower_copy(lowercase_name, orig_class_entry->name, class_entry->name_length); |
zend_hash_update(CG(class_table), lowercase_name, class_entry->name_length+1, &class_entry, sizeof(zend_class_entry *), NULL); | lowercase_name = (char*)zend_new_interned_string(lowercase_name, class_entry->name_length + 1, 1 TSRMLS_CC); |
free(lowercase_name); | if (IS_INTERNED(lowercase_name)) { |
| zend_hash_quick_update(CG(class_table), lowercase_name, class_entry->name_length+1, INTERNED_HASH(lowercase_name), &class_entry, sizeof(zend_class_entry *), NULL); |
| } else { |
| zend_hash_update(CG(class_table), lowercase_name, class_entry->name_length+1, &class_entry, sizeof(zend_class_entry *), NULL); |
| } |
| str_efree(lowercase_name); |
return class_entry; |
return class_entry; |
} |
} |
/* }}} */ |
/* }}} */ |
Line 2267 ZEND_API int zend_register_class_alias_ex(const char *
|
Line 2514 ZEND_API int zend_register_class_alias_ex(const char *
|
char *lcname = zend_str_tolower_dup(name, name_len); |
char *lcname = zend_str_tolower_dup(name, name_len); |
int ret; |
int ret; |
|
|
ret = zend_hash_add(CG(class_table), lcname, name_len+1, &ce, sizeof(zend_class_entry *), NULL); | if (lcname[0] == '\\') { |
| ret = zend_hash_add(CG(class_table), lcname+1, name_len, &ce, sizeof(zend_class_entry *), NULL); |
| } else { |
| ret = zend_hash_add(CG(class_table), lcname, name_len+1, &ce, sizeof(zend_class_entry *), NULL); |
| } |
| |
efree(lcname); |
efree(lcname); |
if (ret == SUCCESS) { |
if (ret == SUCCESS) { |
ce->refcount++; |
ce->refcount++; |
Line 2321 ZEND_API int zend_disable_function(char *function_name
|
Line 2573 ZEND_API int zend_disable_function(char *function_name
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
|
#ifdef ZEND_WIN32 |
|
#pragma optimize("", off) |
|
#endif |
static zend_object_value display_disabled_class(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ |
static zend_object_value display_disabled_class(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ |
{ |
{ |
zend_object_value retval; |
zend_object_value retval; |
zend_object *intern; |
zend_object *intern; |
retval = zend_objects_new(&intern, class_type TSRMLS_CC); |
retval = zend_objects_new(&intern, class_type TSRMLS_CC); |
ALLOC_HASHTABLE(intern->properties); |
|
zend_hash_init(intern->properties, 0, NULL, ZVAL_PTR_DTOR, 0); |
|
zend_error(E_WARNING, "%s() has been disabled for security reasons", class_type->name); |
zend_error(E_WARNING, "%s() has been disabled for security reasons", class_type->name); |
return retval; |
return retval; |
} |
} |
|
#ifdef ZEND_WIN32 |
|
#pragma optimize("", on) |
|
#endif |
/* }}} */ |
/* }}} */ |
|
|
static const zend_function_entry disabled_class_new[] = { |
static const zend_function_entry disabled_class_new[] = { |
Line 2339 static const zend_function_entry disabled_class_new[]
|
Line 2595 static const zend_function_entry disabled_class_new[]
|
|
|
ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC) /* {{{ */ |
ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC) /* {{{ */ |
{ |
{ |
zend_class_entry disabled_class; | zend_class_entry **disabled_class; |
|
|
zend_str_tolower(class_name, class_name_length); |
zend_str_tolower(class_name, class_name_length); |
if (zend_hash_del(CG(class_table), class_name, class_name_length+1)==FAILURE) { | if (zend_hash_find(CG(class_table), class_name, class_name_length+1, (void **)&disabled_class)==FAILURE) { |
return FAILURE; |
return FAILURE; |
} |
} |
INIT_OVERLOADED_CLASS_ENTRY_EX(disabled_class, class_name, class_name_length, disabled_class_new, NULL, NULL, NULL, NULL, NULL); | INIT_CLASS_ENTRY_INIT_METHODS((**disabled_class), disabled_class_new, NULL, NULL, NULL, NULL, NULL); |
disabled_class.create_object = display_disabled_class; | (*disabled_class)->create_object = display_disabled_class; |
disabled_class.name_length = class_name_length; | zend_hash_clean(&((*disabled_class)->function_table)); |
zend_register_internal_class(&disabled_class TSRMLS_CC); | |
return SUCCESS; |
return SUCCESS; |
} |
} |
/* }}} */ |
/* }}} */ |
Line 2400 static int zend_is_callable_check_class(const char *na
|
Line 2655 static int zend_is_callable_check_class(const char *na
|
*strict_class = 1; |
*strict_class = 1; |
ret = 1; |
ret = 1; |
} |
} |
} else if (zend_lookup_class_ex(name, name_len, 1, &pce TSRMLS_CC) == SUCCESS) { | } else if (zend_lookup_class_ex(name, name_len, NULL, 1, &pce TSRMLS_CC) == SUCCESS) { |
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; |
Line 2422 static int zend_is_callable_check_class(const char *na
|
Line 2677 static int zend_is_callable_check_class(const char *na
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
|
|
static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fcall_info_cache *fcc, int strict_class, char **error TSRMLS_DC) /* {{{ */ |
static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fcall_info_cache *fcc, int strict_class, char **error TSRMLS_DC) /* {{{ */ |
{ |
{ |
zend_class_entry *ce_org = fcc->calling_scope; |
zend_class_entry *ce_org = fcc->calling_scope; |
int retval = 0; |
int retval = 0; |
char *mname, *lmname, *colon; | char *mname, *lmname; |
| const char *colon; |
int clen, mlen; |
int clen, mlen; |
zend_class_entry *last_scope; |
zend_class_entry *last_scope; |
HashTable *ftable; |
HashTable *ftable; |
Line 2444 static int zend_is_callable_check_func(int check_flags
|
Line 2699 static int zend_is_callable_check_func(int check_flags
|
/* Skip leading \ */ |
/* Skip leading \ */ |
if (Z_STRVAL_P(callable)[0] == '\\') { |
if (Z_STRVAL_P(callable)[0] == '\\') { |
mlen = Z_STRLEN_P(callable) - 1; |
mlen = Z_STRLEN_P(callable) - 1; |
mname = Z_STRVAL_P(callable) + 1; |
|
lmname = zend_str_tolower_dup(Z_STRVAL_P(callable) + 1, mlen); |
lmname = zend_str_tolower_dup(Z_STRVAL_P(callable) + 1, mlen); |
} else { |
} else { |
mlen = Z_STRLEN_P(callable); |
mlen = Z_STRLEN_P(callable); |
mname = Z_STRVAL_P(callable); |
|
lmname = zend_str_tolower_dup(Z_STRVAL_P(callable), mlen); |
lmname = zend_str_tolower_dup(Z_STRVAL_P(callable), mlen); |
} |
} |
/* Check if function with given name exists. |
/* Check if function with given name exists. |
Line 2519 static int zend_is_callable_check_func(int check_flags
|
Line 2772 static int zend_is_callable_check_func(int check_flags
|
} else if (zend_hash_find(ftable, lmname, mlen+1, (void**)&fcc->function_handler) == SUCCESS) { |
} else if (zend_hash_find(ftable, lmname, mlen+1, (void**)&fcc->function_handler) == SUCCESS) { |
retval = 1; |
retval = 1; |
if ((fcc->function_handler->op_array.fn_flags & ZEND_ACC_CHANGED) && |
if ((fcc->function_handler->op_array.fn_flags & ZEND_ACC_CHANGED) && |
EG(scope) && | !strict_class && EG(scope) && |
instanceof_function(fcc->function_handler->common.scope, EG(scope) TSRMLS_CC)) { |
instanceof_function(fcc->function_handler->common.scope, EG(scope) TSRMLS_CC)) { |
zend_function *priv_fbc; |
zend_function *priv_fbc; |
|
|
Line 2531 static int zend_is_callable_check_func(int check_flags
|
Line 2784 static int zend_is_callable_check_func(int check_flags
|
} |
} |
if ((check_flags & IS_CALLABLE_CHECK_NO_ACCESS) == 0 && |
if ((check_flags & IS_CALLABLE_CHECK_NO_ACCESS) == 0 && |
(fcc->calling_scope && |
(fcc->calling_scope && |
(fcc->calling_scope->__call || | ((fcc->object_ptr && fcc->calling_scope->__call) || |
fcc->calling_scope->__callstatic))) { | (!fcc->object_ptr && fcc->calling_scope->__callstatic)))) { |
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_ptr ? Z_OBJCE_P(fcc->object_ptr) : EG(scope), lmname, mlen TSRMLS_CC)) { |
if (!zend_check_private(fcc->function_handler, fcc->object_ptr ? Z_OBJCE_P(fcc->object_ptr) : EG(scope), lmname, mlen TSRMLS_CC)) { |
retval = 0; |
retval = 0; |
Line 2553 get_function_via_handler:
|
Line 2806 get_function_via_handler:
|
if (strict_class && ce_org->__call) { |
if (strict_class && ce_org->__call) { |
fcc->function_handler = emalloc(sizeof(zend_internal_function)); |
fcc->function_handler = emalloc(sizeof(zend_internal_function)); |
fcc->function_handler->internal_function.type = ZEND_INTERNAL_FUNCTION; |
fcc->function_handler->internal_function.type = ZEND_INTERNAL_FUNCTION; |
fcc->function_handler->internal_function.module = ce_org->module; | fcc->function_handler->internal_function.module = (ce_org->type == ZEND_INTERNAL_CLASS) ? ce_org->info.internal.module : NULL; |
fcc->function_handler->internal_function.handler = zend_std_call_user_call; |
fcc->function_handler->internal_function.handler = zend_std_call_user_call; |
fcc->function_handler->internal_function.arg_info = NULL; |
fcc->function_handler->internal_function.arg_info = NULL; |
fcc->function_handler->internal_function.num_args = 0; |
fcc->function_handler->internal_function.num_args = 0; |
fcc->function_handler->internal_function.scope = ce_org; |
fcc->function_handler->internal_function.scope = ce_org; |
fcc->function_handler->internal_function.fn_flags = ZEND_ACC_CALL_VIA_HANDLER; |
fcc->function_handler->internal_function.fn_flags = ZEND_ACC_CALL_VIA_HANDLER; |
fcc->function_handler->internal_function.function_name = estrndup(mname, mlen); |
fcc->function_handler->internal_function.function_name = estrndup(mname, mlen); |
fcc->function_handler->internal_function.pass_rest_by_reference = 0; |
|
fcc->function_handler->internal_function.return_reference = ZEND_RETURN_VALUE; |
|
call_via_handler = 1; |
call_via_handler = 1; |
retval = 1; |
retval = 1; |
} else if (Z_OBJ_HT_P(fcc->object_ptr)->get_method) { |
} else if (Z_OBJ_HT_P(fcc->object_ptr)->get_method) { |
fcc->function_handler = Z_OBJ_HT_P(fcc->object_ptr)->get_method(&fcc->object_ptr, mname, mlen TSRMLS_CC); | fcc->function_handler = Z_OBJ_HT_P(fcc->object_ptr)->get_method(&fcc->object_ptr, mname, mlen, NULL TSRMLS_CC); |
if (fcc->function_handler) { |
if (fcc->function_handler) { |
if (strict_class && |
if (strict_class && |
(!fcc->function_handler->common.scope || |
(!fcc->function_handler->common.scope || |
!instanceof_function(ce_org, fcc->function_handler->common.scope TSRMLS_CC))) { |
!instanceof_function(ce_org, fcc->function_handler->common.scope TSRMLS_CC))) { |
if ((fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0) { |
if ((fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0) { |
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) { |
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) { |
efree(fcc->function_handler->common.function_name); | efree((char*)fcc->function_handler->common.function_name); |
} |
} |
efree(fcc->function_handler); |
efree(fcc->function_handler); |
} |
} |
Line 2586 get_function_via_handler:
|
Line 2837 get_function_via_handler:
|
if (fcc->calling_scope->get_static_method) { |
if (fcc->calling_scope->get_static_method) { |
fcc->function_handler = fcc->calling_scope->get_static_method(fcc->calling_scope, mname, mlen TSRMLS_CC); |
fcc->function_handler = fcc->calling_scope->get_static_method(fcc->calling_scope, mname, mlen TSRMLS_CC); |
} else { |
} else { |
fcc->function_handler = zend_std_get_static_method(fcc->calling_scope, mname, mlen TSRMLS_CC); | fcc->function_handler = zend_std_get_static_method(fcc->calling_scope, mname, mlen, NULL TSRMLS_CC); |
} |
} |
if (fcc->function_handler) { |
if (fcc->function_handler) { |
retval = 1; |
retval = 1; |
Line 2602 get_function_via_handler:
|
Line 2853 get_function_via_handler:
|
|
|
if (retval) { |
if (retval) { |
if (fcc->calling_scope && !call_via_handler) { |
if (fcc->calling_scope && !call_via_handler) { |
if (!fcc->object_ptr && !(fcc->function_handler->common.fn_flags & ZEND_ACC_STATIC)) { | if (!fcc->object_ptr && (fcc->function_handler->common.fn_flags & ZEND_ACC_ABSTRACT)) { |
| if (error) { |
| zend_spprintf(error, 0, "cannot call abstract method %s::%s()", fcc->calling_scope->name, fcc->function_handler->common.function_name); |
| retval = 0; |
| } else { |
| zend_error(E_ERROR, "Cannot call abstract method %s::%s()", fcc->calling_scope->name, fcc->function_handler->common.function_name); |
| } |
| } else 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) { |
Line 2748 ZEND_API zend_bool zend_is_callable_ex(zval *callable,
|
Line 3006 ZEND_API zend_bool zend_is_callable_ex(zval *callable,
|
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY || |
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY || |
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) { |
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) { |
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) { |
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) { |
efree(fcc->function_handler->common.function_name); | efree((char*)fcc->function_handler->common.function_name); |
} |
} |
efree(fcc->function_handler); |
efree(fcc->function_handler); |
} |
} |
Line 2826 ZEND_API zend_bool zend_is_callable_ex(zval *callable,
|
Line 3084 ZEND_API zend_bool zend_is_callable_ex(zval *callable,
|
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY || |
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY || |
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) { |
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) { |
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) { |
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) { |
efree(fcc->function_handler->common.function_name); | efree((char*)fcc->function_handler->common.function_name); |
} |
} |
efree(fcc->function_handler); |
efree(fcc->function_handler); |
} |
} |
Line 2904 ZEND_API zend_bool zend_make_callable(zval *callable,
|
Line 3162 ZEND_API zend_bool zend_make_callable(zval *callable,
|
fcc.function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY || |
fcc.function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY || |
fcc.function_handler->type == ZEND_OVERLOADED_FUNCTION)) { |
fcc.function_handler->type == ZEND_OVERLOADED_FUNCTION)) { |
if (fcc.function_handler->type != ZEND_OVERLOADED_FUNCTION) { |
if (fcc.function_handler->type != ZEND_OVERLOADED_FUNCTION) { |
efree(fcc.function_handler->common.function_name); | efree((char*)fcc.function_handler->common.function_name); |
} |
} |
efree(fcc.function_handler); |
efree(fcc.function_handler); |
} |
} |
Line 3090 ZEND_API const char *zend_get_module_version(const cha
|
Line 3348 ZEND_API const char *zend_get_module_version(const cha
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC) /* {{{ */ | ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type, const char *doc_comment, int doc_comment_len TSRMLS_DC) /* {{{ */ |
{ |
{ |
zend_property_info property_info; | zend_property_info property_info, *property_info_ptr; |
HashTable *target_symbol_table; | const char *interned_name; |
| ulong h = zend_get_hash_value(name, name_length+1); |
|
|
if (!(access_type & ZEND_ACC_PPP_MASK)) { |
if (!(access_type & ZEND_ACC_PPP_MASK)) { |
access_type |= ZEND_ACC_PUBLIC; |
access_type |= ZEND_ACC_PUBLIC; |
} |
} |
if (access_type & ZEND_ACC_STATIC) { |
if (access_type & ZEND_ACC_STATIC) { |
target_symbol_table = &ce->default_static_members; | if (zend_hash_quick_find(&ce->properties_info, name, name_length + 1, h, (void**)&property_info_ptr) == SUCCESS && |
| (property_info_ptr->flags & ZEND_ACC_STATIC) != 0) { |
| property_info.offset = property_info_ptr->offset; |
| zval_ptr_dtor(&ce->default_static_members_table[property_info.offset]); |
| zend_hash_quick_del(&ce->properties_info, name, name_length + 1, h); |
| } else { |
| property_info.offset = ce->default_static_members_count++; |
| ce->default_static_members_table = perealloc(ce->default_static_members_table, sizeof(zval*) * ce->default_static_members_count, ce->type == ZEND_INTERNAL_CLASS); |
| } |
| ce->default_static_members_table[property_info.offset] = property; |
| if (ce->type == ZEND_USER_CLASS) { |
| ce->static_members_table = ce->default_static_members_table; |
| } |
} else { |
} else { |
target_symbol_table = &ce->default_properties; | if (zend_hash_quick_find(&ce->properties_info, name, name_length + 1, h, (void**)&property_info_ptr) == SUCCESS && |
| (property_info_ptr->flags & ZEND_ACC_STATIC) == 0) { |
| property_info.offset = property_info_ptr->offset; |
| zval_ptr_dtor(&ce->default_properties_table[property_info.offset]); |
| zend_hash_quick_del(&ce->properties_info, name, name_length + 1, h); |
| } else { |
| property_info.offset = ce->default_properties_count++; |
| ce->default_properties_table = perealloc(ce->default_properties_table, sizeof(zval*) * ce->default_properties_count, ce->type == ZEND_INTERNAL_CLASS); |
| } |
| ce->default_properties_table[property_info.offset] = property; |
} |
} |
if (ce->type & ZEND_INTERNAL_CLASS) { |
if (ce->type & ZEND_INTERNAL_CLASS) { |
switch(Z_TYPE_P(property)) { |
switch(Z_TYPE_P(property)) { |
Line 3121 ZEND_API int zend_declare_property_ex(zend_class_entry
|
Line 3401 ZEND_API int zend_declare_property_ex(zend_class_entry
|
int priv_name_length; |
int priv_name_length; |
|
|
zend_mangle_property_name(&priv_name, &priv_name_length, ce->name, ce->name_length, name, name_length, ce->type & ZEND_INTERNAL_CLASS); |
zend_mangle_property_name(&priv_name, &priv_name_length, ce->name, ce->name_length, name, name_length, ce->type & ZEND_INTERNAL_CLASS); |
zend_hash_update(target_symbol_table, priv_name, priv_name_length+1, &property, sizeof(zval *), NULL); |
|
property_info.name = priv_name; |
property_info.name = priv_name; |
property_info.name_length = priv_name_length; |
property_info.name_length = priv_name_length; |
} |
} |
Line 3131 ZEND_API int zend_declare_property_ex(zend_class_entry
|
Line 3410 ZEND_API int zend_declare_property_ex(zend_class_entry
|
int prot_name_length; |
int prot_name_length; |
|
|
zend_mangle_property_name(&prot_name, &prot_name_length, "*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS); |
zend_mangle_property_name(&prot_name, &prot_name_length, "*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS); |
zend_hash_update(target_symbol_table, prot_name, prot_name_length+1, &property, sizeof(zval *), NULL); |
|
property_info.name = prot_name; |
property_info.name = prot_name; |
property_info.name_length = prot_name_length; |
property_info.name_length = prot_name_length; |
} |
} |
break; |
break; |
case ZEND_ACC_PUBLIC: |
case ZEND_ACC_PUBLIC: |
if (ce->parent) { | if (IS_INTERNED(name)) { |
char *prot_name; | property_info.name = (char*)name; |
int prot_name_length; | } else { |
| property_info.name = ce->type & ZEND_INTERNAL_CLASS ? zend_strndup(name, name_length) : estrndup(name, name_length); |
zend_mangle_property_name(&prot_name, &prot_name_length, "*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS); | |
zend_hash_del(target_symbol_table, prot_name, prot_name_length+1); | |
pefree(prot_name, ce->type & ZEND_INTERNAL_CLASS); | |
} |
} |
zend_hash_update(target_symbol_table, name, name_length+1, &property, sizeof(zval *), NULL); |
|
property_info.name = ce->type & ZEND_INTERNAL_CLASS ? zend_strndup(name, name_length) : estrndup(name, name_length); |
|
property_info.name_length = name_length; |
property_info.name_length = name_length; |
break; |
break; |
} |
} |
|
|
|
interned_name = zend_new_interned_string(property_info.name, property_info.name_length+1, 0 TSRMLS_CC); |
|
if (interned_name != property_info.name) { |
|
if (ce->type == ZEND_USER_CLASS) { |
|
efree((char*)property_info.name); |
|
} else { |
|
free((char*)property_info.name); |
|
} |
|
property_info.name = interned_name; |
|
} |
|
|
property_info.flags = access_type; |
property_info.flags = access_type; |
property_info.h = zend_get_hash_value(property_info.name, property_info.name_length+1); | property_info.h = (access_type & ZEND_ACC_PUBLIC) ? h : zend_get_hash_value(property_info.name, property_info.name_length+1); |
|
|
property_info.doc_comment = doc_comment; |
property_info.doc_comment = doc_comment; |
property_info.doc_comment_len = doc_comment_len; |
property_info.doc_comment_len = doc_comment_len; |
|
|
property_info.ce = ce; |
property_info.ce = ce; |
|
|
zend_hash_update(&ce->properties_info, name, name_length + 1, &property_info, sizeof(zend_property_info), NULL); | zend_hash_quick_update(&ce->properties_info, name, name_length+1, h, &property_info, sizeof(zend_property_info), NULL); |
|
|
return SUCCESS; |
return SUCCESS; |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC) /* {{{ */ | ZEND_API int zend_declare_property(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type TSRMLS_DC) /* {{{ */ |
{ |
{ |
return zend_declare_property_ex(ce, name, name_length, property, access_type, NULL, 0 TSRMLS_CC); |
return zend_declare_property_ex(ce, name, name_length, property, access_type, NULL, 0 TSRMLS_CC); |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type TSRMLS_DC) /* {{{ */ | ZEND_API int zend_declare_property_null(zend_class_entry *ce, const char *name, int name_length, int access_type TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *property; |
zval *property; |
|
|
Line 3184 ZEND_API int zend_declare_property_null(zend_class_ent
|
Line 3468 ZEND_API int zend_declare_property_null(zend_class_ent
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API int zend_declare_property_bool(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC) /* {{{ */ | ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, int name_length, long value, int access_type TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *property; |
zval *property; |
|
|
Line 3199 ZEND_API int zend_declare_property_bool(zend_class_ent
|
Line 3483 ZEND_API int zend_declare_property_bool(zend_class_ent
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC) /* {{{ */ | ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, int name_length, long value, int access_type TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *property; |
zval *property; |
|
|
Line 3214 ZEND_API int zend_declare_property_long(zend_class_ent
|
Line 3498 ZEND_API int zend_declare_property_long(zend_class_ent
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API int zend_declare_property_double(zend_class_entry *ce, char *name, int name_length, double value, int access_type TSRMLS_DC) /* {{{ */ | ZEND_API int zend_declare_property_double(zend_class_entry *ce, const char *name, int name_length, double value, int access_type TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *property; |
zval *property; |
|
|
Line 3229 ZEND_API int zend_declare_property_double(zend_class_e
|
Line 3513 ZEND_API int zend_declare_property_double(zend_class_e
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type TSRMLS_DC) /* {{{ */ | ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name, int name_length, const char *value, int access_type TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *property; |
zval *property; |
int len = strlen(value); |
int len = strlen(value); |
Line 3246 ZEND_API int zend_declare_property_string(zend_class_e
|
Line 3530 ZEND_API int zend_declare_property_string(zend_class_e
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int name_length, char *value, int value_len, int access_type TSRMLS_DC) /* {{{ */ | ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *name, int name_length, const char *value, int value_len, int access_type TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *property; |
zval *property; |
|
|
Line 3350 ZEND_API int zend_declare_class_constant_string(zend_c
|
Line 3634 ZEND_API int zend_declare_class_constant_string(zend_c
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC) /* {{{ */ | ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const char *name, int name_length, zval *value TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *property; |
zval *property; |
zend_class_entry *old_scope = EG(scope); |
zend_class_entry *old_scope = EG(scope); |
Line 3358 ZEND_API void zend_update_property(zend_class_entry *s
|
Line 3642 ZEND_API void zend_update_property(zend_class_entry *s
|
EG(scope) = scope; |
EG(scope) = scope; |
|
|
if (!Z_OBJ_HT_P(object)->write_property) { |
if (!Z_OBJ_HT_P(object)->write_property) { |
char *class_name; | const char *class_name; |
zend_uint class_name_len; |
zend_uint class_name_len; |
|
|
zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC); |
zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC); |
Line 3367 ZEND_API void zend_update_property(zend_class_entry *s
|
Line 3651 ZEND_API void zend_update_property(zend_class_entry *s
|
} |
} |
MAKE_STD_ZVAL(property); |
MAKE_STD_ZVAL(property); |
ZVAL_STRINGL(property, name, name_length, 1); |
ZVAL_STRINGL(property, name, name_length, 1); |
Z_OBJ_HT_P(object)->write_property(object, property, value TSRMLS_CC); | Z_OBJ_HT_P(object)->write_property(object, property, value, 0 TSRMLS_CC); |
zval_ptr_dtor(&property); |
zval_ptr_dtor(&property); |
|
|
EG(scope) = old_scope; |
EG(scope) = old_scope; |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, char *name, int name_length TSRMLS_DC) /* {{{ */ | ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, const char *name, int name_length TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *tmp; |
zval *tmp; |
|
|
Line 3386 ZEND_API void zend_update_property_null(zend_class_ent
|
Line 3670 ZEND_API void zend_update_property_null(zend_class_ent
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC) /* {{{ */ | ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, int name_length, long value TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *tmp; |
zval *tmp; |
|
|
Line 3398 ZEND_API void zend_update_property_bool(zend_class_ent
|
Line 3682 ZEND_API void zend_update_property_bool(zend_class_ent
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC) /* {{{ */ | ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, int name_length, long value TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *tmp; |
zval *tmp; |
|
|
Line 3410 ZEND_API void zend_update_property_long(zend_class_ent
|
Line 3694 ZEND_API void zend_update_property_long(zend_class_ent
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, char *name, int name_length, double value TSRMLS_DC) /* {{{ */ | ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, const char *name, int name_length, double value TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *tmp; |
zval *tmp; |
|
|
Line 3422 ZEND_API void zend_update_property_double(zend_class_e
|
Line 3706 ZEND_API void zend_update_property_double(zend_class_e
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, char *name, int name_length, const char *value TSRMLS_DC) /* {{{ */ | ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *tmp; |
zval *tmp; |
|
|
Line 3434 ZEND_API void zend_update_property_string(zend_class_e
|
Line 3718 ZEND_API void zend_update_property_string(zend_class_e
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, const char *value, int value_len TSRMLS_DC) /* {{{ */ | ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value, int value_len TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *tmp; |
zval *tmp; |
|
|
Line 3446 ZEND_API void zend_update_property_stringl(zend_class_
|
Line 3730 ZEND_API void zend_update_property_stringl(zend_class_
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, int name_length, zval *value TSRMLS_DC) /* {{{ */ | ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, int name_length, zval *value TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval **property; |
zval **property; |
zend_class_entry *old_scope = EG(scope); |
zend_class_entry *old_scope = EG(scope); |
|
|
EG(scope) = scope; |
EG(scope) = scope; |
property = zend_std_get_static_property(scope, name, name_length, 0 TSRMLS_CC); | property = zend_std_get_static_property(scope, name, name_length, 0, NULL TSRMLS_CC); |
EG(scope) = old_scope; |
EG(scope) = old_scope; |
if (!property) { |
if (!property) { |
return FAILURE; |
return FAILURE; |
Line 3464 ZEND_API int zend_update_static_property(zend_class_en
|
Line 3748 ZEND_API int zend_update_static_property(zend_class_en
|
(*property)->value = value->value; |
(*property)->value = value->value; |
if (Z_REFCOUNT_P(value) > 0) { |
if (Z_REFCOUNT_P(value) > 0) { |
zval_copy_ctor(*property); |
zval_copy_ctor(*property); |
|
} else { |
|
efree(value); |
} |
} |
} else { |
} else { |
zval *garbage = *property; |
zval *garbage = *property; |
Line 3481 ZEND_API int zend_update_static_property(zend_class_en
|
Line 3767 ZEND_API int zend_update_static_property(zend_class_en
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API int zend_update_static_property_null(zend_class_entry *scope, char *name, int name_length TSRMLS_DC) /* {{{ */ | ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const char *name, int name_length TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *tmp; |
zval *tmp; |
|
|
Line 3493 ZEND_API int zend_update_static_property_null(zend_cla
|
Line 3779 ZEND_API int zend_update_static_property_null(zend_cla
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC) /* {{{ */ | ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, int name_length, long value TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *tmp; |
zval *tmp; |
|
|
Line 3505 ZEND_API int zend_update_static_property_bool(zend_cla
|
Line 3791 ZEND_API int zend_update_static_property_bool(zend_cla
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API int zend_update_static_property_long(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC) /* {{{ */ | ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, int name_length, long value TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *tmp; |
zval *tmp; |
|
|
Line 3517 ZEND_API int zend_update_static_property_long(zend_cla
|
Line 3803 ZEND_API int zend_update_static_property_long(zend_cla
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API int zend_update_static_property_double(zend_class_entry *scope, char *name, int name_length, double value TSRMLS_DC) /* {{{ */ | ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const char *name, int name_length, double value TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *tmp; |
zval *tmp; |
|
|
Line 3529 ZEND_API int zend_update_static_property_double(zend_c
|
Line 3815 ZEND_API int zend_update_static_property_double(zend_c
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API int zend_update_static_property_string(zend_class_entry *scope, char *name, int name_length, const char *value TSRMLS_DC) /* {{{ */ | ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const char *name, int name_length, const char *value TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *tmp; |
zval *tmp; |
|
|
Line 3541 ZEND_API int zend_update_static_property_string(zend_c
|
Line 3827 ZEND_API int zend_update_static_property_string(zend_c
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, char *name, int name_length, const char *value, int value_len TSRMLS_DC) /* {{{ */ | ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, int name_length, const char *value, int value_len TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *tmp; |
zval *tmp; |
|
|
Line 3553 ZEND_API int zend_update_static_property_stringl(zend_
|
Line 3839 ZEND_API int zend_update_static_property_stringl(zend_
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC) /* {{{ */ | ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_bool silent TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval *property, *value; |
zval *property, *value; |
zend_class_entry *old_scope = EG(scope); |
zend_class_entry *old_scope = EG(scope); |
Line 3561 ZEND_API zval *zend_read_property(zend_class_entry *sc
|
Line 3847 ZEND_API zval *zend_read_property(zend_class_entry *sc
|
EG(scope) = scope; |
EG(scope) = scope; |
|
|
if (!Z_OBJ_HT_P(object)->read_property) { |
if (!Z_OBJ_HT_P(object)->read_property) { |
char *class_name; | const char *class_name; |
zend_uint class_name_len; |
zend_uint class_name_len; |
|
|
zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC); |
zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC); |
Line 3570 ZEND_API zval *zend_read_property(zend_class_entry *sc
|
Line 3856 ZEND_API zval *zend_read_property(zend_class_entry *sc
|
|
|
MAKE_STD_ZVAL(property); |
MAKE_STD_ZVAL(property); |
ZVAL_STRINGL(property, name, name_length, 1); |
ZVAL_STRINGL(property, name, name_length, 1); |
value = Z_OBJ_HT_P(object)->read_property(object, property, silent?BP_VAR_IS:BP_VAR_R TSRMLS_CC); | value = Z_OBJ_HT_P(object)->read_property(object, property, silent?BP_VAR_IS:BP_VAR_R, 0 TSRMLS_CC); |
zval_ptr_dtor(&property); |
zval_ptr_dtor(&property); |
|
|
EG(scope) = old_scope; |
EG(scope) = old_scope; |
Line 3578 ZEND_API zval *zend_read_property(zend_class_entry *sc
|
Line 3864 ZEND_API zval *zend_read_property(zend_class_entry *sc
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, int name_length, zend_bool silent TSRMLS_DC) /* {{{ */ | ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, int name_length, zend_bool silent TSRMLS_DC) /* {{{ */ |
{ |
{ |
zval **property; |
zval **property; |
zend_class_entry *old_scope = EG(scope); |
zend_class_entry *old_scope = EG(scope); |
|
|
EG(scope) = scope; |
EG(scope) = scope; |
property = zend_std_get_static_property(scope, name, name_length, silent TSRMLS_CC); | property = zend_std_get_static_property(scope, name, name_length, silent, NULL TSRMLS_CC); |
EG(scope) = old_scope; |
EG(scope) = old_scope; |
|
|
return property?*property:NULL; |
return property?*property:NULL; |
Line 3629 ZEND_API void zend_restore_error_handling(zend_error_h
|
Line 3915 ZEND_API void zend_restore_error_handling(zend_error_h
|
zval_ptr_dtor(&saved->user_handler); |
zval_ptr_dtor(&saved->user_handler); |
} |
} |
saved->user_handler = NULL; |
saved->user_handler = NULL; |
|
} |
|
/* }}} */ |
|
|
|
ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name, zend_uint len) /* {{{ */ |
|
{ |
|
zend_trait_alias *alias, **alias_ptr; |
|
|
|
if ((alias_ptr = ce->trait_aliases)) { |
|
alias = *alias_ptr; |
|
while (alias) { |
|
if (alias->alias_len == len && |
|
!strncasecmp(name, alias->alias, alias->alias_len)) { |
|
return alias->alias; |
|
} |
|
alias_ptr++; |
|
alias = *alias_ptr; |
|
} |
|
} |
|
|
|
return name; |
|
} |
|
/* }}} */ |
|
|
|
ZEND_API const char* zend_resolve_method_name(zend_class_entry *ce, zend_function *f) /* {{{ */ |
|
{ |
|
zend_function *func; |
|
HashPosition iterator; |
|
HashTable *function_table; |
|
|
|
if (f->common.type != ZEND_USER_FUNCTION || |
|
*(f->op_array.refcount) < 2 || |
|
!f->common.scope || |
|
!f->common.scope->trait_aliases) { |
|
return f->common.function_name; |
|
} |
|
|
|
function_table = &ce->function_table; |
|
zend_hash_internal_pointer_reset_ex(function_table, &iterator); |
|
while (zend_hash_get_current_data_ex(function_table, (void **)&func, &iterator) == SUCCESS) { |
|
if (func == f) { |
|
char *name; |
|
uint len; |
|
ulong idx; |
|
|
|
if (zend_hash_get_current_key_ex(function_table, &name, &len, &idx, 0, &iterator) != HASH_KEY_IS_STRING) { |
|
return f->common.function_name; |
|
} |
|
--len; |
|
if (len == strlen(f->common.function_name) && |
|
!strncasecmp(name, f->common.function_name, len)) { |
|
return f->common.function_name; |
|
} |
|
return zend_find_alias_name(f->common.scope, name, len); |
|
} |
|
zend_hash_move_forward_ex(function_table, &iterator); |
|
} |
|
return f->common.function_name; |
} |
} |
/* }}} */ |
/* }}} */ |
|
|