diff options
author | Marcus Boerger <helly@php.net> | 2006-05-09 23:53:23 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2006-05-09 23:53:23 +0000 |
commit | 637a40423cd7632b2800814c2ba3ad9b95bbd2f4 (patch) | |
tree | 485f1dd7cf12d0bfe693961120360b965d66c195 /Zend/zend_builtin_functions.c | |
parent | 57184454e9e3ccecb2b55dc71cd7dc1aa65a3ad3 (diff) | |
download | php-git-637a40423cd7632b2800814c2ba3ad9b95bbd2f4.tar.gz |
- MFH as discussed
. zend_exception_get_default() -> zend_exception_get_default(TSRMLS_D)
. zend_get_error_exception() -> zend_get_error_exception(TSRMLS_D)
. added E_RECOVERABLE_ERROR
. added ZEND_TOSTRING_FUNC_NAME
. added __tostring function cache to zend_class_entry
. added ZEND_NAMED_ME
. modified ZEND_ME_MAPPING to support method flags
. added ZEND_MN
. method entries now use prefix "zim_" instead of "zif_"
. drop EG(ze1_compatibility_mode)
. changed cast handler, now without (int should_free):
typedef int (*zend_object_cast_t)(zval *readobj, zval *retval, int type TSRMLS_DC);
. changed get_iterator, now receives whether value is by ref:
zend_object_iterator *(*get_iterator)(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
. added zend_objects_store_add_ref_by_handle
. added zend_objects_store_del_ref_by_handle
. convert_to_explicit_type(pzv, type)
Diffstat (limited to 'Zend/zend_builtin_functions.c')
-rw-r--r-- | Zend/zend_builtin_functions.c | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index f4a432d028..3d24311310 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -276,7 +276,7 @@ ZEND_FUNCTION(func_get_args) ZEND_NAMED_FUNCTION(zend_if_strlen) { zval **str; - + if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) { ZEND_WRONG_PARAM_COUNT(); } @@ -374,7 +374,7 @@ ZEND_FUNCTION(each) ulong num_key; zval **inserted_pointer; HashTable *target_hash; - + if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) { ZEND_WRONG_PARAM_COUNT(); } @@ -455,7 +455,7 @@ ZEND_FUNCTION(define) zval **var, **val, **non_cs; int case_sensitive; zend_constant c; - + switch (ZEND_NUM_ARGS()) { case 2: if (zend_get_parameters_ex(2, &var, &val)==FAILURE) { @@ -468,7 +468,7 @@ ZEND_FUNCTION(define) RETURN_FALSE; } convert_to_long_ex(non_cs); - if ((*non_cs)->value.lval) { + if (Z_LVAL_PP(non_cs)) { case_sensitive = 0; } else { case_sensitive = CONST_CS; @@ -479,7 +479,7 @@ ZEND_FUNCTION(define) break; } - switch ((*val)->type) { + switch (Z_TYPE_PP(val)) { case IS_LONG: case IS_DOUBLE: case IS_STRING: @@ -515,7 +515,7 @@ ZEND_FUNCTION(defined) { zval **var; zval c; - + if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &var)==FAILURE) { ZEND_WRONG_PARAM_COUNT(); } @@ -539,7 +539,7 @@ ZEND_FUNCTION(get_class) char *name = ""; zend_uint name_len = 0; int dup; - + if (!ZEND_NUM_ARGS()) { if (EG(scope)) { RETURN_STRINGL(EG(scope)->name, EG(scope)->name_length, 1); @@ -623,13 +623,13 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) zend_error(E_WARNING, "Unknown class passed as parameter"); RETURN_FALSE; } - instance_ce = *the_ce; + instance_ce = *the_ce; } else if (Z_TYPE_PP(obj) != IS_OBJECT) { RETURN_FALSE; } else { instance_ce = NULL; } - + /* TBI!! new object handlers */ if (Z_TYPE_PP(obj) == IS_OBJECT && !HAS_CLASS_ENTRY(**obj)) { RETURN_FALSE; @@ -724,7 +724,7 @@ static void add_class_vars(zend_class_entry *ce, HashTable *properties, zval *re if (Z_TYPE_P(prop_copy) == IS_CONSTANT_ARRAY || Z_TYPE_P(prop_copy) == IS_CONSTANT) { zval_update_constant(&prop_copy, 0 TSRMLS_CC); } - + add_assoc_zval(return_value, prop_name, prop_copy); } } @@ -773,7 +773,7 @@ ZEND_FUNCTION(get_object_vars) ZEND_WRONG_PARAM_COUNT(); } - if ((*obj)->type != IS_OBJECT) { + if (Z_TYPE_PP(obj) != IS_OBJECT) { RETURN_FALSE; } if (Z_OBJ_HT_PP(obj)->get_properties == NULL) { @@ -870,7 +870,7 @@ ZEND_FUNCTION(method_exists) zval **klass, **method_name; char *lcname; zend_class_entry * ce, **pce; - + if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &klass, &method_name)==FAILURE) { ZEND_WRONG_PARAM_COUNT(); } @@ -962,7 +962,7 @@ ZEND_FUNCTION(property_exists) } RETURN_BOOL(EG(scope) == ce); RETURN_FALSE; - + case IS_OBJECT: if (Z_OBJ_HANDLER_PP(object, has_property) && Z_OBJ_HANDLER_PP(object, has_property)(*object, *property, 2 TSRMLS_CC)) { RETURN_TRUE; @@ -1086,7 +1086,7 @@ ZEND_FUNCTION(leak) leakbytes = (*leak)->value.lval; } } - + emalloc(leakbytes); } /* }}} */ @@ -1170,7 +1170,7 @@ ZEND_FUNCTION(set_error_handler) zend_bool had_orig_error_handler=0; char *error_handler_name = NULL; long error_type = E_ALL | E_STRICT; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &error_handler, &error_type) == FAILURE) { return; } @@ -1333,7 +1333,7 @@ ZEND_FUNCTION(get_declared_interfaces) { zend_uint mask = ZEND_ACC_INTERFACE; zend_uint comply = 1; - + if (ZEND_NUM_ARGS() != 0) { ZEND_WRONG_PARAM_COUNT(); } @@ -1358,7 +1358,7 @@ static int copy_function_name(zend_function *func, int num_args, va_list args, z } else if (func->type == ZEND_USER_FUNCTION) { add_next_index_stringl(user_ar, hash_key->arKey, hash_key->nKeyLength-1, 1); } - + return 0; } @@ -1369,26 +1369,26 @@ ZEND_FUNCTION(get_defined_functions) { zval *internal; zval *user; - + if (ZEND_NUM_ARGS() != 0) { ZEND_WRONG_PARAM_COUNT(); } - + MAKE_STD_ZVAL(internal); MAKE_STD_ZVAL(user); - + array_init(internal); array_init(user); array_init(return_value); - + zend_hash_apply_with_arguments(EG(function_table), (apply_func_args_t) copy_function_name, 2, internal, user); - - if (zend_hash_add(return_value->value.ht, "internal", sizeof("internal"), (void **)&internal, sizeof(zval *), NULL) == FAILURE) { + + if (zend_hash_add(Z_ARRVAL_P(return_value), "internal", sizeof("internal"), (void **)&internal, sizeof(zval *), NULL) == FAILURE) { zend_error(E_WARNING, "Cannot add internal functions to return value from get_defined_functions()"); RETURN_FALSE; } - - if (zend_hash_add(return_value->value.ht, "user", sizeof("user"), (void **)&user, sizeof(zval *), NULL) == FAILURE) { + + if (zend_hash_add(Z_ARRVAL_P(return_value), "user", sizeof("user"), (void **)&user, sizeof(zval *), NULL) == FAILURE) { zend_error(E_WARNING, "Cannot add user functions to return value from get_defined_functions()"); RETURN_FALSE; } @@ -1399,12 +1399,12 @@ ZEND_FUNCTION(get_defined_functions) /* {{{ proto array get_defined_vars(void) Returns an associative array of names and values of all currently defined variable names (variables in the current scope) */ ZEND_FUNCTION(get_defined_vars) -{ +{ zval *tmp; - + array_init(return_value); - - zend_hash_copy(return_value->value.ht, EG(active_symbol_table), + + zend_hash_copy(Z_ARRVAL_P(return_value), EG(active_symbol_table), (copy_ctor_func_t)zval_add_ref, &tmp, sizeof(zval *)); } /* }}} */ @@ -1568,7 +1568,7 @@ ZEND_FUNCTION(get_defined_constants) modules = ecalloc(zend_hash_num_elements(&module_registry) + 2, sizeof(zval *)); module_names = emalloc((zend_hash_num_elements(&module_registry) + 2) * sizeof(char *)); - + module_names[0] = "internal"; zend_hash_internal_pointer_reset_ex(&module_registry, &pos); while (zend_hash_get_current_data_ex(&module_registry, (void *) &module, &pos) != FAILURE) { @@ -1620,7 +1620,7 @@ static zval *debug_backtrace_get_args(void ***curpos TSRMLS_DC) zval *arg_array, **arg; int arg_count = (ulong) *p; - *curpos -= (arg_count+2); + *curpos -= (arg_count+2); MAKE_STD_ZVAL(arg_array); array_init(arg_array); @@ -1717,7 +1717,7 @@ ZEND_FUNCTION(debug_print_backtrace) arg_array = NULL; skip = ptr; - /* skip internal handler */ + /* skip internal handler */ if (!skip->op_array && skip->prev_execute_data && skip->prev_execute_data->opline && @@ -1744,7 +1744,7 @@ ZEND_FUNCTION(debug_print_backtrace) } else { zend_uint class_name_len; int dup; - + dup = zend_get_object_classname(ptr->object, &class_name, &class_name_len TSRMLS_CC); if(!dup) { free_class_name = class_name; @@ -1764,7 +1764,7 @@ ZEND_FUNCTION(debug_print_backtrace) arg_array = debug_backtrace_get_args(&cur_arg_pos TSRMLS_CC); frames_on_stack--; } - } + } } else { /* i know this is kinda ugly, but i'm trying to avoid extra cycles in the main execution loop */ zend_bool build_filename_arg = 1; @@ -1774,7 +1774,7 @@ ZEND_FUNCTION(debug_print_backtrace) function_name = "unknown"; build_filename_arg = 0; } else - switch (ptr->opline->op2.u.constant.value.lval) { + switch (Z_LVAL(ptr->opline->op2.u.constant)) { case ZEND_EVAL: function_name = "eval"; build_filename_arg = 0; @@ -1927,7 +1927,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int } else { zend_uint class_name_len; int dup; - + dup = zend_get_object_classname(ptr->object, &class_name, &class_name_len TSRMLS_CC); add_assoc_string_ex(stack_frame, "class", sizeof("class"), class_name, dup); @@ -1948,7 +1948,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int add_assoc_zval_ex(stack_frame, "args", sizeof("args"), debug_backtrace_get_args(&cur_arg_pos TSRMLS_CC)); frames_on_stack--; } - } + } } else { /* i know this is kinda ugly, but i'm trying to avoid extra cycles in the main execution loop */ zend_bool build_filename_arg = 1; @@ -1988,7 +1988,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int MAKE_STD_ZVAL(arg_array); array_init(arg_array); - + /* include_filename always points to the last filename of the last last called-fuction. if we have called include in the frame above - this is the file we have included. */ @@ -2017,7 +2017,7 @@ ZEND_FUNCTION(debug_backtrace) if (ZEND_NUM_ARGS()) { ZEND_WRONG_PARAM_COUNT(); } - + zend_fetch_debug_backtrace(return_value, 1, 1 TSRMLS_CC); } /* }}} */ @@ -2066,7 +2066,7 @@ ZEND_FUNCTION(get_extension_funcs) RETURN_FALSE; } efree(lcname); - + if (!(func = module->functions)) { RETURN_FALSE; } |