From: Dmitry Stogov Date: Mon, 13 Feb 2006 10:23:59 +0000 (+0000) Subject: Made server wide switch for unicode on/off (according to PDM). X-Git-Tag: RELEASE_1_2~211 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=09ca61c12509bcfcf7e805064c7fbd7d97f7c4c8;p=php Made server wide switch for unicode on/off (according to PDM). --- diff --git a/Zend/zend.c b/Zend/zend.c index f52942ab14..ca3eb8c79a 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -29,7 +29,18 @@ #include "zend_builtin_functions.h" #include "zend_ini.h" #include "zend_unicode.h" -#include "zend_interfaces.h" + +#ifdef ZTS +# define GLOBAL_FUNCTION_TABLE global_function_table +# define GLOBAL_CLASS_TABLE global_class_table +# define GLOBAL_CONSTANTS_TABLE global_constants_table +# define GLOBAL_AUTO_GLOBALS_TABLE global_auto_globals_table +#else +# define GLOBAL_FUNCTION_TABLE CG(function_table) +# define GLOBAL_CLASS_TABLE CG(class_table) +# define GLOBAL_AUTO_GLOBALS_TABLE CG(auto_globals) +# define GLOBAL_CONSTANTS_TABLE EG(zend_constants) +#endif #if defined(ZEND_WIN32) && ZEND_DEBUG BOOL WINAPI IsDebuggerPresent(VOID); @@ -211,16 +222,12 @@ ZEND_INI_END() ZEND_API int compiler_globals_id; ZEND_API int executor_globals_id; ZEND_API int alloc_globals_id; -#endif static HashTable *global_function_table = NULL; static HashTable *global_class_table = NULL; static HashTable *global_constants_table = NULL; static HashTable *global_auto_globals_table = NULL; -static HashTable *global_u_function_table = NULL; -static HashTable *global_u_class_table = NULL; -static HashTable *global_u_constants_table = NULL; -static HashTable *global_u_auto_globals_table = NULL; static HashTable *global_persistent_list = NULL; +#endif ZEND_API zend_utility_values zend_uv; @@ -373,7 +380,7 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop if ( /* UTODO: clean this up */ - (expr->type == IS_STRING && + (expr->type == IS_STRING && (!strcmp(ucnv_getName(ZEND_U_CONVERTER(UG(output_encoding_conv)), &temp), ucnv_getName(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &temp))))) { *use_copy = 0; @@ -648,13 +655,12 @@ static void zend_set_default_compile_time_values(TSRMLS_D) static void zval_copy_persistent(zval *zv) { - if (Z_TYPE_P(zv) == IS_UNICODE) { - Z_USTRVAL_P(zv) = zend_ustrndup(Z_USTRVAL_P(zv), Z_USTRLEN_P(zv)); - } else if (Z_TYPE_P(zv) == IS_STRING || Z_TYPE_P(zv) == IS_CONSTANT) { + if (Z_TYPE_P(zv) == IS_STRING || Z_TYPE_P(zv) == IS_CONSTANT) { UChar *ustr; ustr = malloc(UBYTES(Z_STRLEN_P(zv)+1)); u_charsToUChars(Z_STRVAL_P(zv), ustr, Z_STRLEN_P(zv)+1); + free(Z_STRVAL_P(zv)); Z_USTRVAL_P(zv) = ustr; if (Z_TYPE_P(zv) == IS_STRING) Z_TYPE_P(zv) = IS_UNICODE; } @@ -673,14 +679,14 @@ static void zend_u_function_dtor(zend_function *function) int n = function->common.num_args; while (n > 0) { - --n; - if (function->common.arg_info[n].name) { - free(function->common.arg_info[n].name); - } - if (function->common.arg_info[n].class_name) { + --n; + if (function->common.arg_info[n].name) { + free(function->common.arg_info[n].name); + } + if (function->common.arg_info[n].class_name) { free(function->common.arg_info[n].class_name); } - } + } free(function->common.arg_info); } } @@ -696,15 +702,7 @@ static void free_u_zend_constant(zend_constant *c) free(c->name); } -static void copy_u_zend_constant(zend_constant *c) -{ - c->name = (char*)zend_ustrndup((UChar*)c->name, c->name_len - 1); - if (!(c->flags & CONST_PERSISTENT)) { - zval_copy_ctor(&c->value); - } -} - -static void function_to_unicode(zend_function *func) +static void function_to_unicode(zend_function *func TSRMLS_DC) { if (func->common.function_name) { UChar *uname; @@ -737,26 +735,22 @@ static void function_to_unicode(zend_function *func) } } -static void property_info_to_unicode(zend_property_info *info) +static void property_info_to_unicode(zend_property_info *info TSRMLS_DC) { if (info->name) { UChar *uname; uname = malloc(UBYTES(info->name_length+1)); u_charsToUChars(info->name, uname, info->name_length+1); + free(info->name); info->name = (char*)uname; info->h = zend_u_get_hash_value(IS_UNICODE, info->name, info->name_length+1); } } -static void zval_ptr_to_unicode(zval **zv) +static void zval_ptr_to_unicode(zval **zv TSRMLS_DC) { - zval *new_zv = malloc(sizeof(zval)); - - memcpy(new_zv, *zv, sizeof(zval)); - new_zv->refcount = 1; - zval_copy_persistent(new_zv); - *zv = new_zv; + zval_copy_persistent(*zv); } static void const_to_unicode(zend_constant *c) @@ -766,157 +760,36 @@ static void const_to_unicode(zend_constant *c) if (c->name) { uname = malloc(UBYTES(c->name_len)); u_charsToUChars(c->name, uname, c->name_len); + free(c->name); c->name = (char*)uname; } - zval_copy_persistent(&c->value); -} - -static void class_to_unicode(zend_class_entry **ce) -{ - zend_class_entry *new_ce = malloc(sizeof(zend_class_entry)); - zend_property_info tmp_info; - zval* tmp_zval; - - memcpy(new_ce, *ce, sizeof(zend_class_entry)); - (*ce)->u_twin = new_ce; - - /* Convert name to unicode */ - if (new_ce->name) { - UChar *uname = malloc(UBYTES(new_ce->name_length+1)); - - u_charsToUChars(new_ce->name, uname, new_ce->name_length+1); - new_ce->name = (char*)uname; - } - - /* Copy methods */ - zend_u_hash_init_ex(&new_ce->function_table, (*ce)->function_table.nNumOfElements, NULL, ZEND_U_FUNCTION_DTOR, 1, 1, 0); - { - Bucket *p = (*ce)->function_table.pListHead; - while (p != NULL) { - zend_function *src = (zend_function*)p->pData; - zend_function *target; - zend_function tmp_func = *src; - - function_to_unicode(&tmp_func); - - zend_hash_add(&new_ce->function_table, p->key.u.string, p->nKeyLength, &tmp_func, sizeof(zend_function), (void**)&target); - src->common.u_twin = target; - - p = p->pListNext; - } - } -/* - zend_hash_copy(&new_ce->function_table, &(*ce)->function_table, (copy_ctor_func_t) function_to_unicode, &tmp_func, sizeof(zend_function)); -*/ - /* Copy constants */ - zend_u_hash_init_ex(&new_ce->constants_table, (*ce)->constants_table.nNumOfElements, NULL, (*ce)->constants_table.pDestructor, 1, 1, 0); - zend_hash_copy(&new_ce->constants_table, &(*ce)->constants_table, (copy_ctor_func_t) zval_ptr_to_unicode, &tmp_zval, sizeof(zval*)); - - /* Copy properties */ - zend_u_hash_init_ex(&new_ce->properties_info, (*ce)->properties_info.nNumOfElements, NULL, (*ce)->properties_info.pDestructor/*(dtor_func_t)zend_destroy_property_info_internal*/, 1, 1, 0); - zend_hash_copy(&new_ce->properties_info, &(*ce)->properties_info, (copy_ctor_func_t) property_info_to_unicode, &tmp_info, sizeof(zend_property_info)); - - zend_u_hash_init_ex(&new_ce->default_properties, (*ce)->default_properties.nNumOfElements, NULL, (*ce)->default_properties.pDestructor, 1, 1, 0); - zend_hash_copy(&new_ce->default_properties, &(*ce)->default_properties, (copy_ctor_func_t) zval_ptr_to_unicode, &tmp_zval, sizeof(zval*)); - - zend_u_hash_init_ex(&new_ce->default_static_members, (*ce)->default_static_members.nNumOfElements, NULL, (*ce)->default_static_members.pDestructor, 1, 1, 0); + if (Z_TYPE(c->value) == IS_STRING || Z_TYPE(c->value) == IS_CONSTANT) { + UChar *ustr; - { - HashPosition pos; - zval **p; - - zend_hash_internal_pointer_reset_ex(&(*ce)->default_static_members, &pos); - while (zend_hash_get_current_data_ex(&(*ce)->default_static_members, (void**)&p, &pos) == SUCCESS) { - char *str_index; - uint str_length; - ulong num_index; - zval **q; - - zend_hash_get_current_key_ex(&(*ce)->default_static_members, &str_index, &str_length, &num_index, 0, &pos); - if ((*p)->is_ref && - (*ce)->parent && - zend_hash_find(&(*ce)->parent->default_static_members, str_index, str_length, (void**)&q) == SUCCESS && - *p == *q && - zend_hash_find(&new_ce->parent->u_twin->default_static_members, str_index, str_length, (void**)&q) == SUCCESS) { - (*q)->refcount++; - (*q)->is_ref = 1; - zend_hash_add(&new_ce->default_static_members, str_index, str_length, (void**)q, sizeof(zval*), NULL); - } else { - zval *q = *p; - zval_ptr_to_unicode(&q); - q->is_ref = 0; - zend_hash_add(&new_ce->default_static_members, str_index, str_length, (void**)&q, sizeof(zval*), NULL); - } - zend_hash_move_forward_ex(&(*ce)->default_static_members, &pos); - } + ustr = malloc(UBYTES(Z_STRLEN(c->value)+1)); + u_charsToUChars(Z_STRVAL(c->value), ustr, Z_STRLEN(c->value)+1); + Z_USTRVAL(c->value) = ustr; + if (Z_TYPE(c->value) == IS_STRING) Z_TYPE(c->value) = IS_UNICODE; } - - *ce = new_ce; } -static void fix_classes(HashTable *ht) { - Bucket *p = ht->pListHead; - Bucket *q; - - /* Fix parent classes */ - while (p != NULL) { - zend_class_entry *ce = *(zend_class_entry**)p->pData; - - if (ce->parent) { - ce->parent = ce->parent->u_twin; - } - if (ce->num_interfaces > 0 && ce->interfaces) { - int i = sizeof(zend_class_entry*)*ce->num_interfaces; - zend_class_entry **new_interfaces; - - new_interfaces = (zend_class_entry**)malloc(i); - memcpy(new_interfaces, ce->interfaces, i); - ce->interfaces = new_interfaces; - for (i = 0; i < ce->num_interfaces; i++) { - ce->interfaces[i] = ce->interfaces[i]->u_twin; - } - } - - q = ce->function_table.pListHead; - while (q != NULL) { - zend_function *f = (zend_function*)q->pData; - - if (f->common.scope) { - f->common.scope = f->common.scope->u_twin; - } - if (f->common.prototype) { - f->common.prototype = f->common.prototype->common.u_twin; - } - q = q->pListNext; - } - - if (ce->constructor) { - ce->constructor = ce->constructor->common.u_twin; - } else if (ce->destructor) { - ce->destructor = ce->destructor->common.u_twin; - } else if (ce->clone) { - ce->clone = ce->clone->common.u_twin; - } else if (ce->__get) { - ce->__get = ce->__get->common.u_twin; - } else if (ce->__set) { - ce->__set = ce->__set->common.u_twin; - } else if (ce->__unset) { - ce->__unset = ce->__unset->common.u_twin; - } else if (ce->__isset) { - ce->__isset = ce->__isset->common.u_twin; - } else if (ce->__call) { - ce->__call = ce->__call->common.u_twin; - } else if (ce->__tostring) { - ce->__tostring = ce->__tostring->common.u_twin; - } else if (ce->serialize_func) { - ce->serialize_func = ce->serialize_func->common.u_twin; - } else if (ce->unserialize_func) { - ce->unserialize_func = ce->unserialize_func->common.u_twin; - } +static void class_to_unicode(zend_class_entry **ce TSRMLS_DC) +{ + /* Convert name to unicode */ + if ((*ce)->name) { + UChar *uname = malloc(UBYTES((*ce)->name_length+1)); - p = p->pListNext; + u_charsToUChars((*ce)->name, uname, (*ce)->name_length+1); + free((*ce)->name); + (*ce)->name = (char*)uname; } + zend_hash_to_unicode(&(*ce)->function_table, (apply_func_t)function_to_unicode TSRMLS_CC); + (*ce)->function_table.pDestructor = ZEND_U_FUNCTION_DTOR; + zend_hash_to_unicode(&(*ce)->constants_table, (apply_func_t)zval_ptr_to_unicode TSRMLS_CC); + zend_hash_to_unicode(&(*ce)->properties_info, (apply_func_t)property_info_to_unicode TSRMLS_CC); + zend_hash_to_unicode(&(*ce)->default_properties, (apply_func_t)zval_ptr_to_unicode TSRMLS_CC); + zend_hash_to_unicode(&(*ce)->default_static_members, (apply_func_t)zval_ptr_to_unicode TSRMLS_CC); } #ifdef ZTS @@ -927,46 +800,23 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS compiler_globals->compiled_filename = NULL; - compiler_globals->global_function_table = compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable)); - zend_u_hash_init_ex(compiler_globals->function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0, 0); + compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable)); + zend_u_hash_init_ex(compiler_globals->function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, UG(unicode), 0); zend_hash_copy(compiler_globals->function_table, global_function_table, NULL, &tmp_func, sizeof(zend_function)); - if (global_u_function_table) { - compiler_globals->global_u_function_table = (HashTable *) malloc(sizeof(HashTable)); - zend_u_hash_init_ex(compiler_globals->global_u_function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, 1, 0); - zend_hash_copy(compiler_globals->global_u_function_table, global_u_function_table, NULL, &tmp_func, sizeof(zend_function)); - } else { - compiler_globals->global_u_function_table = 0; - } - - compiler_globals->global_class_table = compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable)); - zend_u_hash_init_ex(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0, 0); + compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable)); + zend_u_hash_init_ex(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1, UG(unicode), 0); zend_hash_copy(compiler_globals->class_table, global_class_table, (copy_ctor_func_t) zend_class_add_ref, &tmp_class, sizeof(zend_class_entry *)); - if (global_u_class_table) { - compiler_globals->global_u_class_table = (HashTable *) malloc(sizeof(HashTable)); - zend_u_hash_init_ex(compiler_globals->global_u_class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 1, 0); - zend_hash_copy(compiler_globals->global_u_class_table, global_u_class_table, (copy_ctor_func_t) zend_class_add_ref, &tmp_class, sizeof(zend_class_entry *)); - } else { - compiler_globals->global_u_class_table = NULL; - } zend_set_default_compile_time_values(TSRMLS_C); CG(interactive) = 0; CG(literal_type) = IS_STRING; - compiler_globals->global_auto_globals_table = compiler_globals->auto_globals = (HashTable *) malloc(sizeof(HashTable)); - zend_u_hash_init_ex(compiler_globals->auto_globals, 8, NULL, NULL, 1, 0, 0); + compiler_globals->auto_globals = (HashTable *) malloc(sizeof(HashTable)); + zend_u_hash_init_ex(compiler_globals->auto_globals, 8, NULL, NULL, 1, UG(unicode), 0); zend_hash_copy(compiler_globals->auto_globals, global_auto_globals_table, NULL, NULL, sizeof(zend_auto_global) /* empty element */); - if (global_u_auto_globals_table) { - compiler_globals->global_u_auto_globals_table = (HashTable *) malloc(sizeof(HashTable)); - zend_u_hash_init_ex(compiler_globals->global_u_auto_globals_table, 8, NULL, NULL, 1, 1, 0); - zend_hash_copy(compiler_globals->global_u_auto_globals_table, global_u_auto_globals_table, NULL, NULL, sizeof(zend_auto_global) /* empty element */); - } else { - compiler_globals->global_u_auto_globals_table = NULL; - } - compiler_globals->last_static_member = zend_hash_num_elements(compiler_globals->class_table); if (compiler_globals->last_static_member) { compiler_globals->static_members = (HashTable**)calloc(compiler_globals->last_static_member, sizeof(HashTable*)); @@ -978,38 +828,17 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS_DC) { - if (compiler_globals->function_table != global_function_table && - compiler_globals->function_table != global_u_function_table) { - if (compiler_globals->global_function_table) { - zend_hash_destroy(compiler_globals->global_function_table); - free(compiler_globals->global_function_table); - } - if (compiler_globals->global_u_function_table) { - zend_hash_destroy(compiler_globals->global_u_function_table); - free(compiler_globals->global_u_function_table); - } + if (compiler_globals->function_table != GLOBAL_FUNCTION_TABLE) { + zend_hash_destroy(compiler_globals->function_table); + free(compiler_globals->function_table); } - if (compiler_globals->class_table != global_class_table && - compiler_globals->class_table != global_u_class_table) { - if (compiler_globals->global_class_table) { - zend_hash_destroy(compiler_globals->global_class_table); - free(compiler_globals->global_class_table); - } - if (compiler_globals->global_u_class_table) { - zend_hash_destroy(compiler_globals->global_u_class_table); - free(compiler_globals->global_u_class_table); - } + if (compiler_globals->class_table != GLOBAL_CLASS_TABLE) { + zend_hash_destroy(compiler_globals->class_table); + free(compiler_globals->class_table); } - if (compiler_globals->auto_globals != global_auto_globals_table && - compiler_globals->auto_globals != global_u_auto_globals_table) { - if (compiler_globals->global_auto_globals_table) { - zend_hash_destroy(compiler_globals->global_auto_globals_table); - free(compiler_globals->global_auto_globals_table); - } - if (compiler_globals->global_u_auto_globals_table) { - zend_hash_destroy(compiler_globals->global_u_auto_globals_table); - free(compiler_globals->global_u_auto_globals_table); - } + if (compiler_globals->auto_globals != GLOBAL_AUTO_GLOBALS_TABLE) { + zend_hash_destroy(compiler_globals->auto_globals); + free(compiler_globals->auto_globals); } if (compiler_globals->static_members) { free(compiler_globals->static_members); @@ -1020,20 +849,8 @@ static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS_DC) { - zend_constant tmp_const; - zend_startup_constants(TSRMLS_C); - zend_copy_constants(EG(zend_constants), global_constants_table); - EG(global_constants_table) = EG(zend_constants); - - if (global_u_constants_table) { - EG(global_u_constants_table) = (HashTable *) malloc(sizeof(HashTable)); - zend_u_hash_init_ex(EG(global_u_constants_table), global_u_constants_table->nNumOfElements, NULL, ZEND_CONSTANT_DTOR, 1, 1, 0); - zend_hash_copy(EG(global_u_constants_table), global_u_constants_table, (copy_ctor_func_t) copy_u_zend_constant, &tmp_const, sizeof(zend_constant)); - } else { - EG(global_u_constants_table) = NULL; - } - + zend_copy_constants(EG(zend_constants), GLOBAL_CONSTANTS_TABLE); zend_init_rsrc_plist(TSRMLS_C); EG(lambda_count)=0; EG(user_error_handler) = NULL; @@ -1051,16 +868,9 @@ static void executor_globals_dtor(zend_executor_globals *executor_globals TSRMLS if (&executor_globals->persistent_list != global_persistent_list) { zend_destroy_rsrc_list(&executor_globals->persistent_list TSRMLS_CC); } - if (executor_globals->global_constants_table != global_constants_table && - executor_globals->global_u_constants_table != global_u_function_table) { - if (executor_globals->global_constants_table) { - zend_hash_destroy(executor_globals->global_constants_table); - free(executor_globals->global_constants_table); - } - if (executor_globals->global_u_constants_table) { - zend_hash_destroy(executor_globals->global_u_constants_table); - free(executor_globals->global_u_constants_table); - } + if (executor_globals->zend_constants != GLOBAL_CONSTANTS_TABLE) { + zend_hash_destroy(executor_globals->zend_constants); + free(executor_globals->zend_constants); } } @@ -1082,6 +892,7 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals_p TSRMLS_DC) start_memory_manager(TSRMLS_C); } + #if defined(__FreeBSD__) || defined(__DragonFly__) /* FreeBSD and DragonFly floating point precision fix */ #include @@ -1201,15 +1012,15 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i zend_version_info = strdup(ZEND_CORE_VERSION_INFO); zend_version_info_length = sizeof(ZEND_CORE_VERSION_INFO)-1; - global_function_table = (HashTable *) malloc(sizeof(HashTable)); - global_class_table = (HashTable *) malloc(sizeof(HashTable)); - global_auto_globals_table = (HashTable *) malloc(sizeof(HashTable)); - global_constants_table = (HashTable *) malloc(sizeof(HashTable)); + GLOBAL_FUNCTION_TABLE = (HashTable *) malloc(sizeof(HashTable)); + GLOBAL_CLASS_TABLE = (HashTable *) malloc(sizeof(HashTable)); + GLOBAL_AUTO_GLOBALS_TABLE = (HashTable *) malloc(sizeof(HashTable)); + GLOBAL_CONSTANTS_TABLE = (HashTable *) malloc(sizeof(HashTable)); - zend_hash_init_ex(global_function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0); - zend_hash_init_ex(global_class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0); - zend_hash_init_ex(global_auto_globals_table, 8, NULL, (dtor_func_t) zend_auto_global_dtor, 1, 0); - zend_hash_init_ex(global_constants_table, 20, NULL, ZEND_CONSTANT_DTOR, 1, 0); + zend_hash_init_ex(GLOBAL_FUNCTION_TABLE, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0); + zend_hash_init_ex(GLOBAL_CLASS_TABLE, 10, NULL, ZEND_CLASS_DTOR, 1, 0); + zend_hash_init_ex(GLOBAL_AUTO_GLOBALS_TABLE, 8, NULL, (dtor_func_t) zend_auto_global_dtor, 1, 0); + zend_hash_init_ex(GLOBAL_CONSTANTS_TABLE, 20, NULL, ZEND_CONSTANT_DTOR, 1, 0); zend_hash_init_ex(&module_registry, 50, NULL, ZEND_MODULE_DTOR, 1, 0); zend_init_rsrc_list_dtors(); @@ -1235,22 +1046,16 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable)); compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable)); - *compiler_globals->function_table = *global_function_table; - *compiler_globals->class_table = *global_class_table; - compiler_globals->auto_globals = global_auto_globals_table; + *compiler_globals->function_table = *GLOBAL_FUNCTION_TABLE; + *compiler_globals->class_table = *GLOBAL_CLASS_TABLE; + compiler_globals->auto_globals = GLOBAL_AUTO_GLOBALS_TABLE; zend_hash_destroy(executor_globals->zend_constants); - *executor_globals->zend_constants = *global_constants_table; + *executor_globals->zend_constants = *GLOBAL_CONSTANTS_TABLE; #else unicode_globals_ctor(&unicode_globals TSRMLS_CC); scanner_globals_ctor(&ini_scanner_globals TSRMLS_CC); scanner_globals_ctor(&language_scanner_globals TSRMLS_CC); - - CG(function_table) = global_function_table; - CG(class_table) = global_class_table; - CG(auto_globals) = global_auto_globals_table; - EG(zend_constants) = global_constants_table; - zend_set_default_compile_time_values(TSRMLS_C); EG(user_error_handler) = NULL; EG(user_exception_handler) = NULL; @@ -1261,7 +1066,6 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i #ifndef ZTS zend_init_rsrc_plist(TSRMLS_C); - global_persistent_list = &EG(persistent_list); #endif if (start_builtin_functions) { @@ -1290,44 +1094,34 @@ void zend_register_standard_ini_entries(TSRMLS_D) */ void zend_post_startup(TSRMLS_D) { - UConverter *old_runtime_encoding_conv; - UErrorCode status = U_ZERO_ERROR; - zend_function tmp_func; - zend_class_entry *tmp_class; - zend_constant tmp_const; #ifdef ZTS zend_compiler_globals *compiler_globals = ts_resource(compiler_globals_id); zend_executor_globals *executor_globals = ts_resource(executor_globals_id); - *global_function_table = *compiler_globals->function_table; - *global_class_table = *compiler_globals->class_table; - *global_constants_table = *executor_globals->zend_constants; + *GLOBAL_FUNCTION_TABLE = *compiler_globals->function_table; + *GLOBAL_CLASS_TABLE = *compiler_globals->class_table; + *GLOBAL_CONSTANTS_TABLE = *executor_globals->zend_constants; #endif /* Make copies of HashTables with UNICODE */ - old_runtime_encoding_conv = UG(runtime_encoding_conv); - UG(runtime_encoding_conv) = ucnv_open("ASCII", &status); + if (UG(unicode)) { + UConverter *old_runtime_encoding_conv; + UErrorCode status = U_ZERO_ERROR; - global_u_function_table = (HashTable *) malloc(sizeof(HashTable)); - zend_u_hash_init_ex(global_u_function_table, global_function_table->nNumOfElements, NULL, ZEND_U_FUNCTION_DTOR, 1, 1, 0); - zend_hash_copy(global_u_function_table, global_function_table, (copy_ctor_func_t) function_to_unicode, &tmp_func, sizeof(zend_function)); + old_runtime_encoding_conv = UG(runtime_encoding_conv); + UG(runtime_encoding_conv) = ucnv_open("ASCII", &status); - global_u_class_table = (HashTable *) malloc(sizeof(HashTable)); - zend_u_hash_init_ex(global_u_class_table, global_class_table->nNumOfElements, NULL, ZEND_CLASS_DTOR, 1, 1, 0); - zend_hash_copy(global_u_class_table, global_class_table, (copy_ctor_func_t) class_to_unicode, &tmp_class, sizeof(zend_class_entry *)); - fix_classes(global_u_class_table); + zend_hash_to_unicode(GLOBAL_FUNCTION_TABLE, (apply_func_t)function_to_unicode TSRMLS_CC); + GLOBAL_FUNCTION_TABLE->pDestructor = ZEND_U_FUNCTION_DTOR; + zend_hash_to_unicode(GLOBAL_CLASS_TABLE, (apply_func_t)class_to_unicode TSRMLS_CC); + zend_hash_to_unicode(GLOBAL_AUTO_GLOBALS_TABLE, NULL TSRMLS_CC); + zend_hash_to_unicode(GLOBAL_CONSTANTS_TABLE, (apply_func_t)const_to_unicode TSRMLS_CC); + GLOBAL_CONSTANTS_TABLE->pDestructor = ZEND_U_CONSTANT_DTOR; - global_u_auto_globals_table = (HashTable *) malloc(sizeof(HashTable)); - zend_u_hash_init_ex(global_u_auto_globals_table, global_auto_globals_table->nNumOfElements, NULL, NULL, 1, 1, 0); - zend_hash_copy(global_u_auto_globals_table, global_auto_globals_table, NULL, NULL, sizeof(zend_auto_global)); - - global_u_constants_table = (HashTable *) malloc(sizeof(HashTable)); - zend_u_hash_init_ex(global_u_constants_table, global_constants_table->nNumOfElements, NULL, ZEND_U_CONSTANT_DTOR, 1, 1, 0); - zend_hash_copy(global_u_constants_table, global_constants_table, (copy_ctor_func_t) const_to_unicode, &tmp_const, sizeof(zend_constant)); - - ucnv_close(UG(runtime_encoding_conv)); - UG(runtime_encoding_conv) = old_runtime_encoding_conv; + ucnv_close(UG(runtime_encoding_conv)); + UG(runtime_encoding_conv) = old_runtime_encoding_conv; + } #ifdef ZTS zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC); @@ -1347,54 +1141,29 @@ void zend_shutdown(TSRMLS_D) #ifdef ZEND_WIN32 zend_shutdown_timeout_thread(); #endif - if (global_persistent_list) { - zend_destroy_rsrc_list(global_persistent_list TSRMLS_CC); - } + zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC); zend_hash_graceful_reverse_destroy(&module_registry); - zend_hash_destroy(global_function_table); - zend_hash_destroy(global_class_table); - if (global_u_function_table) { - zend_hash_destroy(global_u_function_table); - } - if (global_u_class_table) { - zend_hash_destroy(global_u_class_table); - } + zend_hash_destroy(GLOBAL_FUNCTION_TABLE); + zend_hash_destroy(GLOBAL_CLASS_TABLE); - zend_hash_destroy(global_auto_globals_table); - free(global_auto_globals_table); - if (global_u_auto_globals_table) { - zend_hash_destroy(global_u_auto_globals_table); - free(global_u_auto_globals_table); - } + zend_hash_destroy(GLOBAL_AUTO_GLOBALS_TABLE); + free(GLOBAL_AUTO_GLOBALS_TABLE); zend_shutdown_extensions(TSRMLS_C); free(zend_version_info); - zend_hash_destroy(global_constants_table); - free(global_constants_table); - if (global_u_constants_table) { - zend_hash_destroy(global_u_constants_table); - free(global_u_constants_table); - } - - free(global_function_table); - free(global_class_table); - if (global_u_function_table) { - free(global_u_function_table); - } - if (global_u_class_table) { - free(global_u_class_table); - } + free(GLOBAL_FUNCTION_TABLE); + free(GLOBAL_CLASS_TABLE); + + zend_hash_destroy(GLOBAL_CONSTANTS_TABLE); + free(GLOBAL_CONSTANTS_TABLE); + #ifdef ZTS - global_function_table = NULL; - global_u_function_table = NULL; - global_class_table = NULL; - global_u_class_table = NULL; - global_auto_globals_table = NULL; - global_u_auto_globals_table = NULL; - global_constants_table = NULL; - global_u_constants_table = NULL; + GLOBAL_FUNCTION_TABLE = NULL; + GLOBAL_CLASS_TABLE = NULL; + GLOBAL_AUTO_GLOBALS_TABLE = NULL; + GLOBAL_CONSTANTS_TABLE = NULL; #else unicode_globals_dtor(&unicode_globals TSRMLS_CC); #endif @@ -1489,19 +1258,7 @@ static void shutdown_unicode_request_globals(TSRMLS_D) void zend_activate(TSRMLS_D) { -#ifdef ZTS - CG(function_table) = UG(unicode)?CG(global_u_function_table):CG(global_function_table); - CG(class_table) = UG(unicode)?CG(global_u_class_table):CG(global_class_table); - CG(auto_globals) = UG(unicode)?CG(global_u_auto_globals_table):CG(global_auto_globals_table); - EG(zend_constants) = UG(unicode)?EG(global_u_constants_table):EG(global_constants_table); -#else - CG(function_table) = UG(unicode)?global_u_function_table:global_function_table; - CG(class_table) = UG(unicode)?global_u_class_table:global_class_table; - CG(auto_globals) = UG(unicode)?global_u_auto_globals_table:global_auto_globals_table; - EG(zend_constants) = UG(unicode)?global_u_constants_table:global_constants_table; -#endif init_unicode_request_globals(TSRMLS_C); - init_unicode_strings(); init_compiler(TSRMLS_C); init_executor(TSRMLS_C); @@ -1730,7 +1487,7 @@ ZEND_API void zend_error(int type, const char *format, ...) if (!EG(user_error_handler)) { EG(user_error_handler) = orig_user_error_handler; - } + } else { zval_ptr_dtor(&orig_user_error_handler); } diff --git a/Zend/zend.h b/Zend/zend.h index 99a0ba112a..81f0709363 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -373,8 +373,6 @@ struct _zend_class_entry { char *doc_comment; zend_uint doc_comment_len; - zend_class_entry *u_twin; - struct _zend_module_entry *module; }; @@ -541,7 +539,7 @@ ZEND_API void zend_error(int type, const char *format, ...); void zenderror(char *error); /* The following #define is used for code duality in PHP for Engine 1 & 2 */ -#define ZEND_STANDARD_CLASS_DEF_PTR U_CLASS_ENTRY(zend_standard_class_def) +#define ZEND_STANDARD_CLASS_DEF_PTR zend_standard_class_def extern ZEND_API zend_class_entry *zend_standard_class_def; extern ZEND_API zend_utility_values zend_uv; extern ZEND_API zval zval_used_for_init; diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 07a8fdb0a2..6e87f51569 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -1164,7 +1164,7 @@ ZEND_API int _object_init_ex(zval *arg, zend_class_entry *class_type ZEND_FILE_L ZEND_API int _object_init(zval *arg ZEND_FILE_LINE_DC TSRMLS_DC) { - return _object_init_ex(arg, U_CLASS_ENTRY(zend_standard_class_def) ZEND_FILE_LINE_RELAY_CC TSRMLS_CC); + return _object_init_ex(arg, zend_standard_class_def ZEND_FILE_LINE_RELAY_CC TSRMLS_CC); } diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 8e6572c0fe..035b4238e6 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -114,8 +114,6 @@ typedef struct _zend_function_entry { #endif -#define U_CLASS_ENTRY(ce) ((UG(unicode)&&ce)?ce->u_twin:ce) - #define INIT_CLASS_ENTRY(class_container, class_name, functions) INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, NULL, NULL, NULL) #define INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \ @@ -145,7 +143,6 @@ typedef struct _zend_function_entry { class_container.interfaces = NULL; \ class_container.get_iterator = NULL; \ class_container.iterator_funcs.funcs = NULL; \ - class_container.u_twin = NULL; \ class_container.module = NULL; \ } diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 3178cf60d4..3bbc5a46dd 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -179,7 +179,6 @@ struct _zend_op_array { zend_arg_info *arg_info; zend_bool pass_rest_by_reference; unsigned char return_reference; - union _zend_function *u_twin; /* END of common elements */ zend_uint *refcount; @@ -234,7 +233,6 @@ typedef struct _zend_internal_function { zend_arg_info *arg_info; zend_bool pass_rest_by_reference; unsigned char return_reference; - union _zend_function *u_twin; /* END of common elements */ void (*handler)(INTERNAL_FUNCTION_PARAMETERS); @@ -257,7 +255,6 @@ typedef union _zend_function { zend_arg_info *arg_info; zend_bool pass_rest_by_reference; unsigned char return_reference; - union _zend_function *u_twin; } common; zend_op_array op_array; diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 342988740b..eab7f65881 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -93,9 +93,9 @@ static zend_object_value zend_default_exception_new_ex(zend_class_entry *class_t trace->refcount = 0; zend_fetch_debug_backtrace(trace, skip_top_traces, 0 TSRMLS_CC); - zend_update_property_rt_string(U_CLASS_ENTRY(default_exception_ce), &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC); - zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC); - zend_update_property(U_CLASS_ENTRY(default_exception_ce), &obj, "trace", sizeof("trace")-1, trace TSRMLS_CC); + zend_update_property_rt_string(default_exception_ce, &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC); + zend_update_property_long(default_exception_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC); + zend_update_property(default_exception_ce, &obj, "trace", sizeof("trace")-1, trace TSRMLS_CC); return obj.value.obj; } @@ -139,22 +139,22 @@ ZEND_METHOD(exception, __construct) if (message) { if (message_type == IS_UNICODE) { - zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC); + zend_update_property_unicodel(default_exception_ce, object, "message", sizeof("message")-1, message, message_len TSRMLS_CC); } else if (UG(unicode)) { UErrorCode status = U_ZERO_ERROR; UChar *u_str; int32_t u_len; zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, message, message_len, &status); - zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, u_str, u_len TSRMLS_CC); + zend_update_property_unicodel(default_exception_ce, object, "message", sizeof("message")-1, u_str, u_len TSRMLS_CC); efree(u_str); } else { - zend_update_property_stringl(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC); + zend_update_property_stringl(default_exception_ce, object, "message", sizeof("message")-1, message, message_len TSRMLS_CC); } } if (code) { - zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), object, "code", sizeof("code")-1, code TSRMLS_CC); + zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC); } } /* }}} */ @@ -178,36 +178,36 @@ ZEND_METHOD(error_exception, __construct) if (message) { if (message_type == IS_UNICODE) { - zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC); + zend_update_property_unicodel(default_exception_ce, object, "message", sizeof("message")-1, message, message_len TSRMLS_CC); } else if (UG(unicode)) { UErrorCode status = U_ZERO_ERROR; UChar *u_str; int32_t u_len; zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, message, message_len, &status); - zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, u_str, u_len TSRMLS_CC); + zend_update_property_unicodel(default_exception_ce, object, "message", sizeof("message")-1, u_str, u_len TSRMLS_CC); efree(u_str); } else { - zend_update_property_stringl(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC); + zend_update_property_stringl(default_exception_ce, object, "message", sizeof("message")-1, message, message_len TSRMLS_CC); } } if (code) { - zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), object, "code", sizeof("code")-1, code TSRMLS_CC); + zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC); } - zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), object, "severity", sizeof("severity")-1, severity TSRMLS_CC); + zend_update_property_long(default_exception_ce, object, "severity", sizeof("severity")-1, severity TSRMLS_CC); if (argc >= 4) { if (file_type == IS_UNICODE) { - zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "file", sizeof("file")-1, filename, filename_len TSRMLS_CC); + zend_update_property_unicodel(default_exception_ce, object, "file", sizeof("file")-1, filename, filename_len TSRMLS_CC); } else { - zend_update_property_stringl(U_CLASS_ENTRY(default_exception_ce), object, "file", sizeof("file")-1, filename, filename_len TSRMLS_CC); + zend_update_property_stringl(default_exception_ce, object, "file", sizeof("file")-1, filename, filename_len TSRMLS_CC); } if (argc < 5) { lineno = 0; /* invalidate lineno */ } - zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), object, "line", sizeof("line")-1, lineno TSRMLS_CC); + zend_update_property_long(default_exception_ce, object, "line", sizeof("line")-1, lineno TSRMLS_CC); } } /* }}} */ @@ -221,7 +221,7 @@ static void _default_exception_get_entry(zval *object, char *name, int name_len, { zval *value; - value = zend_read_property(U_CLASS_ENTRY(default_exception_ce), object, name, name_len, 0 TSRMLS_CC); + value = zend_read_property(default_exception_ce, object, name, name_len, 0 TSRMLS_CC); *return_value = *value; zval_copy_ctor(return_value); @@ -524,7 +524,7 @@ ZEND_METHOD(exception, getTraceAsString) char *res = estrdup(""), **str = &res, *s_tmp; int res_len = 0, *len = &res_len, num = 0; - trace = zend_read_property(U_CLASS_ENTRY(default_exception_ce), getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC); + trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC); zend_hash_apply_with_arguments(Z_ARRVAL_P(trace), (apply_func_args_t)_build_trace_string, 3, str, len, &num); s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 7 + 1); @@ -596,7 +596,7 @@ ZEND_METHOD(exception, __toString) /* We store the result in the private property string so we can access * the result in uncaught exception handlers without memleaks. */ - zend_update_property_string(U_CLASS_ENTRY(default_exception_ce), getThis(), "string", sizeof("string")-1, str TSRMLS_CC); + zend_update_property_string(default_exception_ce, getThis(), "string", sizeof("string")-1, str TSRMLS_CC); if (trace) { zval_ptr_dtor(&trace); @@ -678,12 +678,12 @@ void zend_register_default_exception(TSRMLS_D) ZEND_API zend_class_entry *zend_exception_get_default(TSRMLS_D) { - return U_CLASS_ENTRY(default_exception_ce); + return default_exception_ce; } ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D) { - return U_CLASS_ENTRY(error_exception_ce); + return error_exception_ce; } @@ -693,21 +693,21 @@ ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, char *messa MAKE_STD_ZVAL(ex); if (exception_ce) { - if (!instanceof_function(exception_ce, U_CLASS_ENTRY(default_exception_ce) TSRMLS_CC)) { + if (!instanceof_function(exception_ce, default_exception_ce TSRMLS_CC)) { zend_error(E_NOTICE, "Exceptions must be derived from the Exception base class"); - exception_ce = U_CLASS_ENTRY(default_exception_ce); + exception_ce = default_exception_ce; } } else { - exception_ce = U_CLASS_ENTRY(default_exception_ce); + exception_ce = default_exception_ce; } object_init_ex(ex, exception_ce); if (message) { - zend_update_property_rt_string(U_CLASS_ENTRY(default_exception_ce), ex, "message", sizeof("message")-1, message TSRMLS_CC); + zend_update_property_rt_string(default_exception_ce, ex, "message", sizeof("message")-1, message TSRMLS_CC); } if (code) { - zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), ex, "code", sizeof("code")-1, code TSRMLS_CC); + zend_update_property_long(default_exception_ce, ex, "code", sizeof("code")-1, code TSRMLS_CC); } zend_throw_exception_internal(ex TSRMLS_CC); @@ -733,7 +733,7 @@ ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long cod ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, char *message, long code, int severity TSRMLS_DC) { zval *ex = zend_throw_exception(exception_ce, message, code TSRMLS_CC); - zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), ex, "severity", sizeof("severity")-1, severity TSRMLS_CC); + zend_update_property_long(default_exception_ce, ex, "severity", sizeof("severity")-1, severity TSRMLS_CC); return ex; } @@ -750,7 +750,7 @@ static void zend_error_va(int type, const char *file, uint lineno, const char *f ZEND_API void zend_exception_error(zval *exception TSRMLS_DC) { zend_class_entry *ce_exception = Z_OBJCE_P(exception); - if (instanceof_function(ce_exception, U_CLASS_ENTRY(default_exception_ce) TSRMLS_CC)) { + if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) { zval *str, *file, *line; EG(exception) = NULL; @@ -760,16 +760,16 @@ ZEND_API void zend_exception_error(zval *exception TSRMLS_DC) if (Z_TYPE_P(str) != IS_STRING) { zend_error(E_WARNING, "%v::__toString() must return a string", ce_exception->name); } else { - zend_update_property_string(U_CLASS_ENTRY(default_exception_ce), exception, "string", sizeof("string")-1, EG(exception) ? ce_exception->name : Z_STRVAL_P(str) TSRMLS_CC); + zend_update_property_string(default_exception_ce, exception, "string", sizeof("string")-1, EG(exception) ? ce_exception->name : Z_STRVAL_P(str) TSRMLS_CC); } } zval_ptr_dtor(&str); if (EG(exception)) { /* do the best we can to inform about the inner exception */ - if (instanceof_function(ce_exception, U_CLASS_ENTRY(default_exception_ce) TSRMLS_CC)) { - file = zend_read_property(U_CLASS_ENTRY(default_exception_ce), EG(exception), "file", sizeof("file")-1, 1 TSRMLS_CC); - line = zend_read_property(U_CLASS_ENTRY(default_exception_ce), EG(exception), "line", sizeof("line")-1, 1 TSRMLS_CC); + if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) { + file = zend_read_property(default_exception_ce, EG(exception), "file", sizeof("file")-1, 1 TSRMLS_CC); + line = zend_read_property(default_exception_ce, EG(exception), "line", sizeof("line")-1, 1 TSRMLS_CC); } else { file = NULL; line = NULL; @@ -777,9 +777,9 @@ ZEND_API void zend_exception_error(zval *exception TSRMLS_DC) zend_error_va(E_WARNING, file ? Z_STRVAL_P(file) : NULL, line ? Z_LVAL_P(line) : 0, "Uncaught %v in exception handling during call to %v::__tostring()", Z_OBJCE_P(EG(exception))->name, ce_exception->name); } - str = zend_read_property(U_CLASS_ENTRY(default_exception_ce), exception, "string", sizeof("string")-1, 1 TSRMLS_CC); - file = zend_read_property(U_CLASS_ENTRY(default_exception_ce), exception, "file", sizeof("file")-1, 1 TSRMLS_CC); - line = zend_read_property(U_CLASS_ENTRY(default_exception_ce), exception, "line", sizeof("line")-1, 1 TSRMLS_CC); + str = zend_read_property(default_exception_ce, exception, "string", sizeof("string")-1, 1 TSRMLS_CC); + file = zend_read_property(default_exception_ce, exception, "file", sizeof("file")-1, 1 TSRMLS_CC); + line = zend_read_property(default_exception_ce, exception, "line", sizeof("line")-1, 1 TSRMLS_CC); if (Z_TYPE_P(file) == IS_UNICODE) { zval copy; @@ -806,7 +806,7 @@ ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC) exception_ce = Z_OBJCE_P(exception); - if (!exception_ce || !instanceof_function(exception_ce, U_CLASS_ENTRY(default_exception_ce) TSRMLS_CC)) { + if (!exception_ce || !instanceof_function(exception_ce, default_exception_ce TSRMLS_CC)) { zend_error(E_ERROR, "Exceptions must be valid objects derived from the Exception base class"); } zend_throw_exception_internal(exception TSRMLS_CC); diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index 5aa82c41fd..6af32473b1 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -137,13 +137,6 @@ struct _zend_compiler_globals { char *script_encoding; #ifdef ZTS - HashTable *global_function_table; - HashTable *global_class_table; - HashTable *global_auto_globals_table; - HashTable *global_u_function_table; - HashTable *global_u_class_table; - HashTable *global_u_auto_globals_table; - HashTable **static_members; int last_static_member; #endif @@ -236,11 +229,6 @@ struct _zend_executor_globals { zend_property_info std_property_info; -#ifdef ZTS - HashTable *global_constants_table; - HashTable *global_u_constants_table; -#endif - void *reserved[ZEND_MAX_RESERVED_RESOURCES]; }; diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index b8edfd43ac..1423557dc6 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -49,16 +49,16 @@ #define UNICODE_KEY(ht, type, arKey, nKeyLength, tmp) \ if (ht->unicode && type == IS_STRING) { \ - UErrorCode status = U_ZERO_ERROR; \ + UErrorCode status = U_ZERO_ERROR; \ UChar *u = NULL; \ int32_t u_len; \ TSRMLS_FETCH(); \ zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u, &u_len, (char*)arKey, nKeyLength-1, &status); \ - if (U_FAILURE(status)) { \ + if (U_FAILURE(status)) { \ /* UTODO: */ \ - } \ - type = IS_UNICODE; \ - tmp = arKey = u; \ + } \ + type = IS_UNICODE; \ + tmp = arKey = u; \ } @@ -1781,6 +1781,57 @@ void zend_hash_display(HashTable *ht) p = p->pListLast; } } + +ZEND_API void zend_hash_to_unicode(HashTable *ht, apply_func_t apply_func TSRMLS_DC) +{ + Bucket **p; + uint nIndex; + + IS_CONSISTENT(ht); + if (ht->unicode) { + return; + } + + ht->unicode = 1; + memset(ht->arBuckets, 0, ht->nTableSize * sizeof(Bucket *)); + p = &ht->pListHead; + while ((*p) != NULL) { + if ((*p)->key.type == IS_STRING) { + UErrorCode status = U_ZERO_ERROR; + UChar *u = NULL; + int32_t u_len; + Bucket *q; + + zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u, &u_len, (char*)(*p)->key.u.string, (*p)->nKeyLength-1, &status); + + q = (Bucket *) pemalloc(sizeof(Bucket)-sizeof(q->key.u)+((u_len+1)*2), ht->persistent); + memcpy(q, *p, sizeof(Bucket)-sizeof(q->key.u)); + memcpy(q->key.u.unicode, u, (u_len+1)*2); + q->key.type = IS_UNICODE; + q->nKeyLength = u_len+1; + q->h = zend_u_inline_hash_func(IS_UNICODE, (void*)q->key.u.unicode, q->nKeyLength); + if ((*p)->pData == &(*p)->pDataPtr) { + q->pData = &q->pDataPtr; + } + efree(u); + pefree(*p, ht->persistent); + *p = q; + if (q->pListNext) { + q->pListNext->pListLast = q; + } else { + ht->pListTail = q; + } + } + nIndex = (*p)->h & ht->nTableMask; + CONNECT_TO_BUCKET_DLLIST(*p, ht->arBuckets[nIndex]); + ht->arBuckets[nIndex] = *p; + if (apply_func) { + apply_func((*p)->pData TSRMLS_CC); + } + p = &(*p)->pListNext; + } +} + #endif /* diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index 532620c1e3..19a8f2c03f 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -175,6 +175,7 @@ ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t ap */ ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC); +ZEND_API void zend_hash_to_unicode(HashTable *ht, apply_func_t apply_func TSRMLS_DC); /* Deletes */ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag); diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h index ca424f5ac4..d0f1321b94 100644 --- a/Zend/zend_ini.h +++ b/Zend/zend_ini.h @@ -193,6 +193,7 @@ END_EXTERN_C() typedef void (*zend_ini_parser_cb_t)(zval *arg1, zval *arg2, int callback_type, void *arg); BEGIN_EXTERN_C() ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg); +ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg); END_EXTERN_C() #define ZEND_INI_PARSER_ENTRY 1 diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y index 8c1976ac88..8d9098f9ed 100644 --- a/Zend/zend_ini_parser.y +++ b/Zend/zend_ini_parser.y @@ -157,10 +157,14 @@ static void ini_error(char *str) TSRMLS_FETCH(); currently_parsed_filename = zend_ini_scanner_get_filename(TSRMLS_C); - error_buf_len = 128+strlen(currently_parsed_filename); /* should be more than enough */ - error_buf = (char *) emalloc(error_buf_len); + if (currently_parsed_filename) { + error_buf_len = 128+strlen(currently_parsed_filename); /* should be more than enough */ + error_buf = (char *) emalloc(error_buf_len); - sprintf(error_buf, "Error parsing %s on line %d\n", currently_parsed_filename, zend_ini_scanner_get_lineno(TSRMLS_C)); + sprintf(error_buf, "Error parsing %s on line %d\n", currently_parsed_filename, zend_ini_scanner_get_lineno(TSRMLS_C)); + } else { + error_buf = estrdup("Invalid configuration directive\n"); + } if (CG(ini_parser_unbuffered_errors)) { #ifdef PHP_WIN32 @@ -202,6 +206,30 @@ ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_erro } +ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg) +{ + int len; + zend_ini_parser_param ini_parser_param; + TSRMLS_FETCH(); + + ini_parser_param.ini_parser_cb = ini_parser_cb; + ini_parser_param.arg = arg; + + CG(ini_parser_param) = &ini_parser_param; + if (zend_ini_prepare_string_for_scanning(str TSRMLS_CC)==FAILURE) { + return FAILURE; + } + + CG(ini_parser_unbuffered_errors) = unbuffered_errors; + + if (ini_parse(TSRMLS_C)) { + return SUCCESS; + } else { + return FAILURE; + } +} + + %} %pure_parser diff --git a/Zend/zend_ini_scanner.h b/Zend/zend_ini_scanner.h index e5cc41d583..95499f0722 100644 --- a/Zend/zend_ini_scanner.h +++ b/Zend/zend_ini_scanner.h @@ -26,6 +26,7 @@ BEGIN_EXTERN_C() int zend_ini_scanner_get_lineno(TSRMLS_D); char *zend_ini_scanner_get_filename(TSRMLS_D); int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC); +int zend_ini_prepare_string_for_scanning(char *str TSRMLS_DC); void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC); int ini_lex(zval *ini_lval TSRMLS_DC); END_EXTERN_C() diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l index 5f21e86a2d..c42051938f 100644 --- a/Zend/zend_ini_scanner.l +++ b/Zend/zend_ini_scanner.l @@ -87,6 +87,16 @@ int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC) } +int zend_ini_prepare_string_for_scanning(char *str TSRMLS_DC) +{ + int len = strlen(str); + + yyin = NULL; + yy_scan_buffer(str, len + 2 TSRMLS_CC); + ini_filename = NULL; + return SUCCESS; +} + void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC) { zend_stream_close(fh); diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 66f43f9fc0..07b9d450c2 100755 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -325,11 +325,11 @@ static int zend_implement_traversable(zend_class_entry *interface, zend_class_en return SUCCESS; } for (i = 0; i < class_type->num_interfaces; i++) { - if (class_type->interfaces[i] == U_CLASS_ENTRY(zend_ce_aggregate) || class_type->interfaces[i] == U_CLASS_ENTRY(zend_ce_iterator)) { + if (class_type->interfaces[i] == zend_ce_aggregate || class_type->interfaces[i] == zend_ce_iterator) { return SUCCESS; } } - zend_error(E_CORE_ERROR, "Class %v must implement interface %s as part of either %s or %s", + zend_error(E_CORE_ERROR, "Class %v must implement interface %v as part of either %v or %v", class_type->name, zend_ce_traversable->name, zend_ce_iterator->name, @@ -351,10 +351,10 @@ static int zend_implement_aggregate(zend_class_entry *interface, zend_class_entr /* c-level get_iterator cannot be changed (exception being only Traversable is implmented) */ if (class_type->num_interfaces) { for (i = 0; i < class_type->num_interfaces; i++) { - if (class_type->interfaces[i] == U_CLASS_ENTRY(zend_ce_iterator)) { + if (class_type->interfaces[i] == zend_ce_iterator) { return FAILURE; } - if (class_type->interfaces[i] == U_CLASS_ENTRY(zend_ce_traversable)) { + if (class_type->interfaces[i] == zend_ce_traversable) { t = i; } } diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 710484fb34..4804f1dad8 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -436,7 +436,7 @@ zval *zend_std_read_dimension(zval *object, zval *offset, int type TSRMLS_DC) zend_class_entry *ce = Z_OBJCE_P(object); zval *retval; - if (instanceof_function_ex(ce, U_CLASS_ENTRY(zend_ce_arrayaccess), 1 TSRMLS_CC)) { + if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC)) { if(offset == NULL) { /* [] construct */ ALLOC_INIT_ZVAL(offset); @@ -469,7 +469,7 @@ static void zend_std_write_dimension(zval *object, zval *offset, zval *value TSR { zend_class_entry *ce = Z_OBJCE_P(object); - if (instanceof_function_ex(ce, U_CLASS_ENTRY(zend_ce_arrayaccess), 1 TSRMLS_CC)) { + if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC)) { if (!offset) { ALLOC_INIT_ZVAL(offset); } else { @@ -489,7 +489,7 @@ static int zend_std_has_dimension(zval *object, zval *offset, int check_empty TS zval *retval; int result; - if (instanceof_function_ex(ce, U_CLASS_ENTRY(zend_ce_arrayaccess), 1 TSRMLS_CC)) { + if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC)) { SEPARATE_ARG_IF_REF(offset); zend_call_method_with_1_params(&object, ce, NULL, "offsetexists", &retval, offset); if (retval) { @@ -603,7 +603,7 @@ static void zend_std_unset_dimension(zval *object, zval *offset TSRMLS_DC) { zend_class_entry *ce = Z_OBJCE_P(object); - if (instanceof_function_ex(ce, U_CLASS_ENTRY(zend_ce_arrayaccess), 1 TSRMLS_CC)) { + if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC)) { SEPARATE_ARG_IF_REF(offset); zend_call_method_with_1_params(&object, ce, NULL, "offsetunset", NULL, offset); zval_ptr_dtor(&offset); diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 884d0da224..a0ece2f3e3 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -838,7 +838,7 @@ ZEND_API void convert_to_object(zval *op) switch (op->type) { case IS_ARRAY: { - object_and_properties_init(op, U_CLASS_ENTRY(zend_standard_class_def), op->value.ht); + object_and_properties_init(op, zend_standard_class_def, op->value.ht); return; break; } diff --git a/ext/com_dotnet/com_misc.c b/ext/com_dotnet/com_misc.c index edbc3d55ba..250b0ed87a 100644 --- a/ext/com_dotnet/com_misc.c +++ b/ext/com_dotnet/com_misc.c @@ -36,7 +36,7 @@ void php_com_throw_exception(HRESULT code, char *message TSRMLS_DC) message = php_win_err(code); free_msg = 1; } - zend_throw_exception(U_CLASS_ENTRY(php_com_exception_class_entry), message, (long)code TSRMLS_CC); + zend_throw_exception(php_com_exception_class_entry, message, (long)code TSRMLS_CC); if (free_msg) { LocalFree(message); } diff --git a/ext/dom/attr.c b/ext/dom/attr.c index a5874fc35a..311496282b 100644 --- a/ext/dom/attr.c +++ b/ext/dom/attr.c @@ -54,8 +54,8 @@ PHP_METHOD(domattr, __construct) char *name, *value = NULL; int name_len, value_len, name_valid; - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(dom_domexception_class_entry) TSRMLS_CC); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, U_CLASS_ENTRY(dom_attr_class_entry), &name, &name_len, &value, &value_len) == FAILURE) { + php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, dom_attr_class_entry, &name, &name_len, &value, &value_len) == FAILURE) { php_std_error_handling(); return; } @@ -263,7 +263,7 @@ PHP_FUNCTION(dom_attr_is_id) dom_object *intern; xmlAttrPtr attrp; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_attr_class_entry)) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_attr_class_entry) == FAILURE) { return; } diff --git a/ext/dom/cdatasection.c b/ext/dom/cdatasection.c index d0f34a1651..7d997fd4e2 100644 --- a/ext/dom/cdatasection.c +++ b/ext/dom/cdatasection.c @@ -50,8 +50,8 @@ PHP_METHOD(domcdatasection, __construct) char *value = NULL; int value_len; - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(dom_domexception_class_entry) TSRMLS_CC); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_cdatasection_class_entry), &value, &value_len) == FAILURE) { + php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_cdatasection_class_entry, &value, &value_len) == FAILURE) { php_std_error_handling(); return; } diff --git a/ext/dom/characterdata.c b/ext/dom/characterdata.c index eb90421ffb..b45578e1e9 100644 --- a/ext/dom/characterdata.c +++ b/ext/dom/characterdata.c @@ -154,7 +154,7 @@ PHP_FUNCTION(dom_characterdata_substring_data) int length; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &id, U_CLASS_ENTRY(dom_characterdata_class_entry), &offset, &count) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &id, dom_characterdata_class_entry, &offset, &count) == FAILURE) { return; } @@ -202,7 +202,7 @@ PHP_FUNCTION(dom_characterdata_append_data) char *arg; int arg_len; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_characterdata_class_entry), &arg, &arg_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_characterdata_class_entry, &arg, &arg_len) == FAILURE) { return; } @@ -229,7 +229,7 @@ PHP_FUNCTION(dom_characterdata_insert_data) int length, arg_len; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &id, U_CLASS_ENTRY(dom_characterdata_class_entry), &offset, &arg, &arg_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &id, dom_characterdata_class_entry, &offset, &arg, &arg_len) == FAILURE) { return; } @@ -277,7 +277,7 @@ PHP_FUNCTION(dom_characterdata_delete_data) int length; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &id, U_CLASS_ENTRY(dom_characterdata_class_entry), &offset, &count) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &id, dom_characterdata_class_entry, &offset, &count) == FAILURE) { return; } @@ -334,7 +334,7 @@ PHP_FUNCTION(dom_characterdata_replace_data) int length, arg_len; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olls", &id, U_CLASS_ENTRY(dom_characterdata_class_entry), &offset, &count, &arg, &arg_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olls", &id, dom_characterdata_class_entry, &offset, &count, &arg, &arg_len) == FAILURE) { return; } diff --git a/ext/dom/comment.c b/ext/dom/comment.c index 1c0a3ec5b1..c4653d7419 100644 --- a/ext/dom/comment.c +++ b/ext/dom/comment.c @@ -50,8 +50,8 @@ PHP_METHOD(domcomment, __construct) char *value = NULL; int value_len; - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(dom_domexception_class_entry) TSRMLS_CC); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|s", &id, U_CLASS_ENTRY(dom_comment_class_entry), &value, &value_len) == FAILURE) { + php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|s", &id, dom_comment_class_entry, &value, &value_len) == FAILURE) { php_std_error_handling(); return; } diff --git a/ext/dom/document.c b/ext/dom/document.c index 0191220404..470b488343 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -774,7 +774,7 @@ PHP_FUNCTION(dom_document_create_element) int ret, name_len, value_len; char *name, *value = NULL; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, U_CLASS_ENTRY(dom_document_class_entry), &name, &name_len, &value, &value_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, dom_document_class_entry, &name, &name_len, &value, &value_len) == FAILURE) { return; } @@ -807,7 +807,7 @@ PHP_FUNCTION(dom_document_create_document_fragment) dom_object *intern; int ret; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_document_class_entry)) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_document_class_entry) == FAILURE) { return; } @@ -836,7 +836,7 @@ PHP_FUNCTION(dom_document_create_text_node) dom_object *intern; char *value; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &value, &value_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &value, &value_len) == FAILURE) { return; } @@ -865,7 +865,7 @@ PHP_FUNCTION(dom_document_create_comment) dom_object *intern; char *value; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &value, &value_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &value, &value_len) == FAILURE) { return; } @@ -894,7 +894,7 @@ PHP_FUNCTION(dom_document_create_cdatasection) dom_object *intern; char *value; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &value, &value_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &value, &value_len) == FAILURE) { return; } @@ -923,7 +923,7 @@ PHP_FUNCTION(dom_document_create_processing_instruction) dom_object *intern; char *name, *value = NULL; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, U_CLASS_ENTRY(dom_document_class_entry), &name, &name_len, &value, &value_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, dom_document_class_entry, &name, &name_len, &value, &value_len) == FAILURE) { return; } @@ -959,7 +959,7 @@ PHP_FUNCTION(dom_document_create_attribute) dom_object *intern; char *name; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &name, &name_len) == FAILURE) { return; } @@ -994,7 +994,7 @@ PHP_FUNCTION(dom_document_create_entity_reference) int ret, name_len; char *name; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &name, &name_len) == FAILURE) { return; } @@ -1028,7 +1028,7 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name) char *name; xmlChar *local; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &name, &name_len) == FAILURE) { return; } @@ -1056,7 +1056,7 @@ PHP_FUNCTION(dom_document_import_node) int ret; long recursive = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|l", &id, U_CLASS_ENTRY(dom_document_class_entry), &node, U_CLASS_ENTRY(dom_node_class_entry), &recursive) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|l", &id, dom_document_class_entry, &node, dom_node_class_entry, &recursive) == FAILURE) { return; } @@ -1101,7 +1101,7 @@ PHP_FUNCTION(dom_document_create_element_ns) int errorcode; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s|s", &id, U_CLASS_ENTRY(dom_document_class_entry), &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s|s", &id, dom_document_class_entry, &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) { return; } @@ -1165,7 +1165,7 @@ PHP_FUNCTION(dom_document_create_attribute_ns) dom_object *intern; int errorcode; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, U_CLASS_ENTRY(dom_document_class_entry), &uri, &uri_len, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_document_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) { return; } @@ -1228,7 +1228,7 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name_ns) char *uri, *name; xmlChar *local, *nsuri; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, U_CLASS_ENTRY(dom_document_class_entry), &uri, &uri_len, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, dom_document_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) { return; } @@ -1256,7 +1256,7 @@ PHP_FUNCTION(dom_document_get_element_by_id) dom_object *intern; char *idname; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &idname, &idname_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &idname, &idname_len) == FAILURE) { return; } @@ -1295,7 +1295,7 @@ PHP_FUNCTION(dom_document_normalize_document) xmlDocPtr docp; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_document_class_entry)) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_document_class_entry) == FAILURE) { return; } @@ -1326,8 +1326,8 @@ PHP_METHOD(domdocument, __construct) char *encoding, *version = NULL; int encoding_len = 0, version_len = 0, refcount; - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(dom_domexception_class_entry) TSRMLS_CC); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ss", &id, U_CLASS_ENTRY(dom_document_class_entry), &version, &version_len, &encoding, &encoding_len) == FAILURE) { + php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ss", &id, dom_document_class_entry, &version, &version_len, &encoding, &encoding_len) == FAILURE) { php_std_error_handling(); return; } @@ -1534,7 +1534,7 @@ static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) { long options = 0; id = getThis(); - if (id != NULL && ! instanceof_function(Z_OBJCE_P(id), U_CLASS_ENTRY(dom_document_class_entry) TSRMLS_CC)) { + if (id != NULL && ! instanceof_function(Z_OBJCE_P(id), dom_document_class_entry TSRMLS_CC)) { id = NULL; } @@ -1613,7 +1613,7 @@ PHP_FUNCTION(dom_document_save) char *file; long options = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &id, U_CLASS_ENTRY(dom_document_class_entry), &file, &file_len, &options) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &id, dom_document_class_entry, &file, &file_len, &options) == FAILURE) { return; } @@ -1659,7 +1659,7 @@ PHP_FUNCTION(dom_document_savexml) int size, format, saveempty; long options = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|O!l", &id, U_CLASS_ENTRY(dom_document_class_entry), &nodep, U_CLASS_ENTRY(dom_node_class_entry), &options) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|O!l", &id, dom_document_class_entry, &nodep, dom_node_class_entry, &options) == FAILURE) { return; } @@ -1758,7 +1758,7 @@ PHP_FUNCTION(dom_document_xinclude) int err; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &id, U_CLASS_ENTRY(dom_document_class_entry), &flags) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &id, dom_document_class_entry, &flags) == FAILURE) { return; } @@ -1797,7 +1797,7 @@ PHP_FUNCTION(dom_document_validate) dom_object *intern; xmlValidCtxt *cvp; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_document_class_entry)) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_document_class_entry) == FAILURE) { return; } @@ -1839,7 +1839,7 @@ _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type) int is_valid; char resolved_path[MAXPATHLEN + 1]; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &source, &source_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &source, &source_len) == FAILURE) { return; } @@ -1929,7 +1929,7 @@ _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int type) int is_valid; char resolved_path[MAXPATHLEN + 1]; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &source, &source_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &source, &source_len) == FAILURE) { return; } @@ -2053,7 +2053,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) if (!newdoc) RETURN_FALSE; - if (id != NULL && instanceof_function(Z_OBJCE_P(id), U_CLASS_ENTRY(dom_document_class_entry) TSRMLS_CC)) { + if (id != NULL && instanceof_function(Z_OBJCE_P(id), dom_document_class_entry TSRMLS_CC)) { intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC); if (intern != NULL) { docp = (xmlDocPtr) dom_object_get_node(intern); @@ -2110,7 +2110,7 @@ PHP_FUNCTION(dom_document_save_html_file) dom_doc_propsptr doc_props; char *file; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &file, &file_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &file, &file_len) == FAILURE) { return; } @@ -2145,7 +2145,7 @@ PHP_FUNCTION(dom_document_save_html) xmlChar *mem; int size; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_document_class_entry)) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_document_class_entry) == FAILURE) { return; } @@ -2176,7 +2176,7 @@ PHP_METHOD(domdocument, registerNodeClass) dom_object *intern; zend_uchar type1, type2; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss!", &id, U_CLASS_ENTRY(dom_document_class_entry), &baseclass, &baseclass_len, &extendedclass, &extendedclass_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss!", &id, dom_document_class_entry, &baseclass, &baseclass_len, &extendedclass, &extendedclass_len) == FAILURE) { return; } @@ -2189,7 +2189,7 @@ PHP_METHOD(domdocument, registerNodeClass) basece = *pce; } - if (basece == NULL || ! instanceof_function(basece, U_CLASS_ENTRY(dom_node_class_entry) TSRMLS_CC)) { + if (basece == NULL || ! instanceof_function(basece, dom_node_class_entry TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s is not derived from DOMNode.", baseclass); return; } diff --git a/ext/dom/documentfragment.c b/ext/dom/documentfragment.c index 142321f7bc..1afc644fc1 100644 --- a/ext/dom/documentfragment.c +++ b/ext/dom/documentfragment.c @@ -49,7 +49,7 @@ PHP_METHOD(domdocumentfragment, __construct) xmlNodePtr nodep = NULL, oldnode = NULL; dom_object *intern; - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(dom_domexception_class_entry) TSRMLS_CC); + php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_documentfragment_class_entry) == FAILURE) { php_std_error_handling(); return; diff --git a/ext/dom/dom_iterators.c b/ext/dom/dom_iterators.c index 865400d655..c9a7dd300c 100644 --- a/ext/dom/dom_iterators.c +++ b/ext/dom/dom_iterators.c @@ -161,7 +161,7 @@ static int php_dom_iterator_current_key(zend_object_iterator *iter, char **str_k object = (zval *)iterator->intern.data; - if (instanceof_function(Z_OBJCE_P(object), U_CLASS_ENTRY(dom_nodelist_class_entry) TSRMLS_CC)) { + if (instanceof_function(Z_OBJCE_P(object), dom_nodelist_class_entry TSRMLS_CC)) { *int_key = iter->index - 1; return HASH_KEY_IS_LONG; } else { diff --git a/ext/dom/domexception.c b/ext/dom/domexception.c index db16e67537..3f898513c4 100644 --- a/ext/dom/domexception.c +++ b/ext/dom/domexception.c @@ -45,7 +45,7 @@ zend_function_entry php_dom_domexception_class_functions[] = { void php_dom_throw_error_with_message(int error_code, char *error_message, int strict_error TSRMLS_DC) { if (strict_error == 1) { - zend_throw_exception(U_CLASS_ENTRY(dom_domexception_class_entry), error_message, error_code TSRMLS_CC); + zend_throw_exception(dom_domexception_class_entry, error_message, error_code TSRMLS_CC); } else { php_libxml_issue_error(E_WARNING, error_message TSRMLS_CC); } diff --git a/ext/dom/domimplementation.c b/ext/dom/domimplementation.c index c9b3798db2..aa371f8154 100644 --- a/ext/dom/domimplementation.c +++ b/ext/dom/domimplementation.c @@ -134,7 +134,7 @@ PHP_METHOD(domimplementation, createDocument) char *prefix = NULL, *localname = NULL; dom_object *doctobj; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ssO", &uri, &uri_len, &name, &name_len, &node, U_CLASS_ENTRY(dom_documenttype_class_entry)) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ssO", &uri, &uri_len, &name, &name_len, &node, dom_documenttype_class_entry) == FAILURE) { return; } diff --git a/ext/dom/element.c b/ext/dom/element.c index c68b9fab0c..08b3dcbe8b 100644 --- a/ext/dom/element.c +++ b/ext/dom/element.c @@ -71,8 +71,8 @@ PHP_METHOD(domelement, __construct) int name_len, value_len = 0, name_valid; xmlNsPtr nsptr = NULL; - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(dom_domexception_class_entry) TSRMLS_CC); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s!s", &id, U_CLASS_ENTRY(dom_element_class_entry), &name, &name_len, &value, &value_len, &uri, &uri_len) == FAILURE) { + php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s!s", &id, dom_element_class_entry, &name, &name_len, &value, &value_len, &uri, &uri_len) == FAILURE) { php_std_error_handling(); return; } @@ -202,7 +202,7 @@ PHP_FUNCTION(dom_element_get_attribute) dom_object *intern; int name_len; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_element_class_entry), &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) { return; } @@ -233,7 +233,7 @@ PHP_FUNCTION(dom_element_set_attribute) char *name, *value; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, U_CLASS_ENTRY(dom_element_class_entry), &name, &name_len, &value, &value_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, dom_element_class_entry, &name, &name_len, &value, &value_len) == FAILURE) { return; } @@ -278,7 +278,7 @@ PHP_FUNCTION(dom_element_remove_attribute) int name_len; char *name; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_element_class_entry), &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) { return; } @@ -322,7 +322,7 @@ PHP_FUNCTION(dom_element_get_attribute_node) dom_object *intern; char *name; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_element_class_entry), &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) { return; } @@ -350,7 +350,7 @@ PHP_FUNCTION(dom_element_set_attribute_node) dom_object *intern, *attrobj, *oldobj; int ret; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, U_CLASS_ENTRY(dom_element_class_entry), &node, U_CLASS_ENTRY(dom_attr_class_entry)) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, dom_element_class_entry, &node, dom_attr_class_entry) == FAILURE) { return; } @@ -413,7 +413,7 @@ PHP_FUNCTION(dom_element_remove_attribute_node) dom_object *intern, *attrobj; int ret; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, U_CLASS_ENTRY(dom_element_class_entry), &node, U_CLASS_ENTRY(dom_attr_class_entry)) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, dom_element_class_entry, &node, dom_attr_class_entry) == FAILURE) { return; } @@ -452,7 +452,7 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name) char *name; xmlChar *local; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_element_class_entry), &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) { return; } @@ -479,7 +479,7 @@ PHP_FUNCTION(dom_element_get_attribute_ns) int uri_len = 0, name_len = 0; char *uri, *name, *strattr; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, U_CLASS_ENTRY(dom_element_class_entry), &uri, &uri_len, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) { return; } @@ -559,7 +559,7 @@ PHP_FUNCTION(dom_element_set_attribute_ns) dom_object *intern; int errorcode = 0, stricterror, is_xmlns = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!ss", &id, U_CLASS_ENTRY(dom_element_class_entry), &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!ss", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) { return; } @@ -668,7 +668,7 @@ PHP_FUNCTION(dom_element_remove_attribute_ns) int name_len, uri_len; char *name, *uri; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, U_CLASS_ENTRY(dom_element_class_entry), &uri, &uri_len, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) { return; } @@ -725,7 +725,7 @@ PHP_FUNCTION(dom_element_get_attribute_node_ns) int uri_len, name_len, ret; char *uri, *name; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, U_CLASS_ENTRY(dom_element_class_entry), &uri, &uri_len, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) { return; } @@ -756,7 +756,7 @@ PHP_FUNCTION(dom_element_set_attribute_node_ns) dom_object *intern, *attrobj, *oldobj; int ret; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, U_CLASS_ENTRY(dom_element_class_entry), &node, U_CLASS_ENTRY(dom_attr_class_entry)) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, dom_element_class_entry, &node, dom_attr_class_entry) == FAILURE) { return; } @@ -827,7 +827,7 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name_ns) char *uri, *name; xmlChar *local, *nsuri; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, U_CLASS_ENTRY(dom_element_class_entry), &uri, &uri_len, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) { return; } @@ -855,7 +855,7 @@ PHP_FUNCTION(dom_element_has_attribute) char *name, *value; int name_len; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_element_class_entry), &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) { return; } @@ -885,7 +885,7 @@ PHP_FUNCTION(dom_element_has_attribute_ns) int uri_len, name_len; char *uri, *name, *value; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, U_CLASS_ENTRY(dom_element_class_entry), &uri, &uri_len, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) { return; } @@ -942,7 +942,7 @@ PHP_FUNCTION(dom_element_set_id_attribute) int name_len; zend_bool is_id; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Osb", &id, U_CLASS_ENTRY(dom_element_class_entry), &name, &name_len, &is_id) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Osb", &id, dom_element_class_entry, &name, &name_len, &is_id) == FAILURE) { return; } @@ -979,7 +979,7 @@ PHP_FUNCTION(dom_element_set_id_attribute_ns) char *uri, *name; zend_bool is_id; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ossb", &id, U_CLASS_ENTRY(dom_element_class_entry), &uri, &uri_len, &name, &name_len, &is_id) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ossb", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len, &is_id) == FAILURE) { return; } @@ -1016,7 +1016,7 @@ PHP_FUNCTION(dom_element_set_id_attribute_node) int name_len; zend_bool is_id; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OOb", &id, U_CLASS_ENTRY(dom_element_class_entry), &node, U_CLASS_ENTRY(dom_attr_class_entry), &is_id) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OOb", &id, dom_element_class_entry, &node, dom_attr_class_entry, &is_id) == FAILURE) { return; } diff --git a/ext/dom/entityreference.c b/ext/dom/entityreference.c index f11ba09ac5..53ec62548a 100644 --- a/ext/dom/entityreference.c +++ b/ext/dom/entityreference.c @@ -50,8 +50,8 @@ PHP_METHOD(domentityreference, __construct) char *name; int name_len, name_valid; - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(dom_domexception_class_entry) TSRMLS_CC); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_entityreference_class_entry), &name, &name_len) == FAILURE) { + php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_entityreference_class_entry, &name, &name_len) == FAILURE) { php_std_error_handling(); return; } diff --git a/ext/dom/namednodemap.c b/ext/dom/namednodemap.c index 76fcda8a7a..53707d02fb 100644 --- a/ext/dom/namednodemap.c +++ b/ext/dom/namednodemap.c @@ -104,7 +104,7 @@ PHP_FUNCTION(dom_namednodemap_get_named_item) xmlNodePtr nodep; xmlNotation *notep = NULL; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_namednodemap_class_entry), &named, &namedlen) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_namednodemap_class_entry, &named, &namedlen) == FAILURE) { return; } @@ -176,7 +176,7 @@ PHP_FUNCTION(dom_namednodemap_item) xmlNodePtr nodep, curnode; int count; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, U_CLASS_ENTRY(dom_namednodemap_class_entry), &index) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, dom_namednodemap_class_entry, &index) == FAILURE) { return; } if (index >= 0) { @@ -232,7 +232,7 @@ PHP_FUNCTION(dom_namednodemap_get_named_item_ns) xmlNodePtr nodep; xmlNotation *notep = NULL; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, U_CLASS_ENTRY(dom_namednodemap_class_entry), &uri, &urilen, &named, &namedlen) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_namednodemap_class_entry, &uri, &urilen, &named, &namedlen) == FAILURE) { return; } diff --git a/ext/dom/node.c b/ext/dom/node.c index 6630dc13ad..0efe9bb252 100644 --- a/ext/dom/node.c +++ b/ext/dom/node.c @@ -913,7 +913,7 @@ PHP_FUNCTION(dom_node_insert_before) dom_object *intern, *childobj, *refpobj; int ret, stricterror; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|O!", &id, U_CLASS_ENTRY(dom_node_class_entry), &node, U_CLASS_ENTRY(dom_node_class_entry), &ref, U_CLASS_ENTRY(dom_node_class_entry)) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|O!", &id, dom_node_class_entry, &node, dom_node_class_entry, &ref, dom_node_class_entry) == FAILURE) { return; } @@ -1077,7 +1077,7 @@ PHP_FUNCTION(dom_node_replace_child) int ret; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OOO", &id, U_CLASS_ENTRY(dom_node_class_entry), &newnode, U_CLASS_ENTRY(dom_node_class_entry), &oldnode, U_CLASS_ENTRY(dom_node_class_entry)) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OOO", &id, dom_node_class_entry, &newnode, dom_node_class_entry, &oldnode, dom_node_class_entry) == FAILURE) { return; } @@ -1167,7 +1167,7 @@ PHP_FUNCTION(dom_node_remove_child) dom_object *intern, *childobj; int ret, stricterror; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, U_CLASS_ENTRY(dom_node_class_entry), &node, U_CLASS_ENTRY(dom_node_class_entry)) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, dom_node_class_entry, &node, dom_node_class_entry) == FAILURE) { return; } @@ -1220,7 +1220,7 @@ PHP_FUNCTION(dom_node_append_child) dom_object *intern, *childobj; int ret, stricterror; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, U_CLASS_ENTRY(dom_node_class_entry), &node, U_CLASS_ENTRY(dom_node_class_entry)) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, dom_node_class_entry, &node, dom_node_class_entry) == FAILURE) { return; } @@ -1321,7 +1321,7 @@ PHP_FUNCTION(dom_node_has_child_nodes) xmlNode *nodep; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_node_class_entry)) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_node_class_entry) == FAILURE) { return; } @@ -1353,7 +1353,7 @@ PHP_FUNCTION(dom_node_clone_node) dom_object *intern; long recursive = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &id, U_CLASS_ENTRY(dom_node_class_entry), &recursive) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &id, dom_node_class_entry, &recursive) == FAILURE) { return; } @@ -1414,7 +1414,7 @@ PHP_FUNCTION(dom_node_normalize) xmlNode *nodep; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_node_class_entry)) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_node_class_entry) == FAILURE) { return; } @@ -1436,7 +1436,7 @@ PHP_FUNCTION(dom_node_is_supported) int feature_len, version_len; char *feature, *version; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, U_CLASS_ENTRY(dom_node_class_entry), &feature, &feature_len, &version, &version_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, dom_node_class_entry, &feature, &feature_len, &version, &version_len) == FAILURE) { return; } @@ -1459,7 +1459,7 @@ PHP_FUNCTION(dom_node_has_attributes) xmlNode *nodep; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_node_class_entry)) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_node_class_entry) == FAILURE) { return; } @@ -1497,7 +1497,7 @@ PHP_FUNCTION(dom_node_is_same_node) xmlNodePtr nodeotherp, nodep; dom_object *intern, *nodeotherobj; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, U_CLASS_ENTRY(dom_node_class_entry), &node, U_CLASS_ENTRY(dom_node_class_entry)) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, dom_node_class_entry, &node, dom_node_class_entry) == FAILURE) { return; } @@ -1527,7 +1527,7 @@ PHP_FUNCTION(dom_node_lookup_prefix) int uri_len = 0; char *uri; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_node_class_entry), &uri, &uri_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_node_class_entry, &uri, &uri_len) == FAILURE) { return; } @@ -1578,7 +1578,7 @@ PHP_FUNCTION(dom_node_is_default_namespace) int uri_len = 0; char *uri; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_node_class_entry), &uri, &uri_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_node_class_entry, &uri, &uri_len) == FAILURE) { return; } @@ -1609,7 +1609,7 @@ PHP_FUNCTION(dom_node_lookup_namespace_uri) int prefix_len = 0; char *prefix; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_node_class_entry), &prefix, &prefix_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_node_class_entry, &prefix, &prefix_len) == FAILURE) { return; } diff --git a/ext/dom/nodelist.c b/ext/dom/nodelist.c index 85e5c967ad..8989f907ad 100644 --- a/ext/dom/nodelist.c +++ b/ext/dom/nodelist.c @@ -111,7 +111,7 @@ PHP_FUNCTION(dom_nodelist_item) HashTable *nodeht; zval **entry; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, U_CLASS_ENTRY(dom_nodelist_class_entry), &index) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, dom_nodelist_class_entry, &index) == FAILURE) { return; } diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index c02605cd89..72560bf6de 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -1049,7 +1049,7 @@ void dom_objects_clone(void *object, void **object_clone TSRMLS_DC) clone = dom_objects_set_class(intern->std.ce, 0 TSRMLS_CC); - if (instanceof_function(intern->std.ce, U_CLASS_ENTRY(dom_node_class_entry) TSRMLS_CC)) { + if (instanceof_function(intern->std.ce, dom_node_class_entry TSRMLS_CC)) { node = (xmlNodePtr)dom_object_get_node((dom_object *) object); if (node != NULL) { cloned_node = xmlDocCopyNode(node, node->doc, 1); @@ -1170,9 +1170,9 @@ void php_dom_create_interator(zval *return_value, int ce_type TSRMLS_DC) zend_class_entry *ce; if (ce_type == DOM_NAMEDNODEMAP) { - ce = U_CLASS_ENTRY(dom_namednodemap_class_entry); + ce = dom_namednodemap_class_entry; } else { - ce = U_CLASS_ENTRY(dom_nodelist_class_entry); + ce = dom_nodelist_class_entry; } object_init_ex(return_value, ce); @@ -1209,69 +1209,69 @@ PHP_DOM_EXPORT zval *php_dom_create_object(xmlNodePtr obj, int *found, zval *wra case XML_DOCUMENT_NODE: case XML_HTML_DOCUMENT_NODE: { - ce = U_CLASS_ENTRY(dom_document_class_entry); + ce = dom_document_class_entry; break; } case XML_DTD_NODE: case XML_DOCUMENT_TYPE_NODE: { - ce = U_CLASS_ENTRY(dom_documenttype_class_entry); + ce = dom_documenttype_class_entry; break; } case XML_ELEMENT_NODE: { - ce = U_CLASS_ENTRY(dom_element_class_entry); + ce = dom_element_class_entry; break; } case XML_ATTRIBUTE_NODE: { - ce = U_CLASS_ENTRY(dom_attr_class_entry); + ce = dom_attr_class_entry; break; } case XML_TEXT_NODE: { - ce = U_CLASS_ENTRY(dom_text_class_entry); + ce = dom_text_class_entry; break; } case XML_COMMENT_NODE: { - ce = U_CLASS_ENTRY(dom_comment_class_entry); + ce = dom_comment_class_entry; break; } case XML_PI_NODE: { - ce = U_CLASS_ENTRY(dom_processinginstruction_class_entry); + ce = dom_processinginstruction_class_entry; break; } case XML_ENTITY_REF_NODE: { - ce = U_CLASS_ENTRY(dom_entityreference_class_entry); + ce = dom_entityreference_class_entry; break; } case XML_ENTITY_DECL: case XML_ELEMENT_DECL: { - ce = U_CLASS_ENTRY(dom_entity_class_entry); + ce = dom_entity_class_entry; break; } case XML_CDATA_SECTION_NODE: { - ce = U_CLASS_ENTRY(dom_cdatasection_class_entry); + ce = dom_cdatasection_class_entry; break; } case XML_DOCUMENT_FRAG_NODE: { - ce = U_CLASS_ENTRY(dom_documentfragment_class_entry); + ce = dom_documentfragment_class_entry; break; } case XML_NOTATION_NODE: { - ce = U_CLASS_ENTRY(dom_notation_class_entry); + ce = dom_notation_class_entry; break; } case XML_NAMESPACE_DECL: { - ce = U_CLASS_ENTRY(dom_namespace_node_class_entry); + ce = dom_namespace_node_class_entry; break; } default: @@ -1300,7 +1300,7 @@ PHP_DOM_EXPORT zval *php_dom_create_object(xmlNodePtr obj, int *found, zval *wra void php_dom_create_implementation(zval **retval TSRMLS_DC) { - object_init_ex(*retval, U_CLASS_ENTRY(dom_domimplementation_class_entry)); + object_init_ex(*retval, dom_domimplementation_class_entry); } /* {{{ int dom_hierarchy(xmlNodePtr parent, xmlNodePtr child) */ diff --git a/ext/dom/processinginstruction.c b/ext/dom/processinginstruction.c index 00abbec135..a948b9603c 100644 --- a/ext/dom/processinginstruction.c +++ b/ext/dom/processinginstruction.c @@ -50,8 +50,8 @@ PHP_METHOD(domprocessinginstruction, __construct) char *name, *value = NULL; int name_len, value_len, name_valid; - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(dom_domexception_class_entry) TSRMLS_CC); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, U_CLASS_ENTRY(dom_processinginstruction_class_entry), &name, &name_len, &value, &value_len) == FAILURE) { + php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, dom_processinginstruction_class_entry, &name, &name_len, &value, &value_len) == FAILURE) { php_std_error_handling(); return; } diff --git a/ext/dom/text.c b/ext/dom/text.c index 89537930f2..9124de9ea5 100644 --- a/ext/dom/text.c +++ b/ext/dom/text.c @@ -54,8 +54,8 @@ PHP_METHOD(domtext, __construct) char *value = NULL; int value_len; - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(dom_domexception_class_entry) TSRMLS_CC); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|s", &id, U_CLASS_ENTRY(dom_text_class_entry), &value, &value_len) == FAILURE) { + php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|s", &id, dom_text_class_entry, &value, &value_len) == FAILURE) { php_std_error_handling(); return; } @@ -125,7 +125,7 @@ PHP_FUNCTION(dom_text_split_text) int length; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, U_CLASS_ENTRY(dom_text_class_entry), &offset) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, dom_text_class_entry, &offset) == FAILURE) { return; } DOM_GET_OBJ(node, id, xmlNodePtr, intern); @@ -177,7 +177,7 @@ PHP_FUNCTION(dom_text_is_whitespace_in_element_content) xmlNodePtr node; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_text_class_entry)) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_text_class_entry) == FAILURE) { return; } DOM_GET_OBJ(node, id, xmlNodePtr, intern); diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c index 9621530af3..6148880b80 100644 --- a/ext/dom/xpath.c +++ b/ext/dom/xpath.c @@ -52,8 +52,8 @@ PHP_METHOD(domxpath, __construct) dom_object *docobj, *intern; xmlXPathContextPtr ctx, oldctx; - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(dom_domexception_class_entry) TSRMLS_CC); - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, U_CLASS_ENTRY(dom_xpath_class_entry), &doc, U_CLASS_ENTRY(dom_document_class_entry)) == FAILURE) { + php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, dom_xpath_class_entry, &doc, dom_document_class_entry) == FAILURE) { php_std_error_handling(); return; } @@ -111,7 +111,7 @@ PHP_FUNCTION(dom_xpath_register_ns) dom_object *intern; unsigned char *prefix, *ns_uri; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, U_CLASS_ENTRY(dom_xpath_class_entry), &prefix, &prefix_len, &ns_uri, &ns_uri_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, dom_xpath_class_entry, &prefix, &prefix_len, &ns_uri, &ns_uri_len) == FAILURE) { return; } @@ -151,7 +151,7 @@ static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) { xmlNsPtr *ns; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|O", &id, U_CLASS_ENTRY(dom_xpath_class_entry), &expr, &expr_len, &context, U_CLASS_ENTRY(dom_node_class_entry)) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|O", &id, dom_xpath_class_entry, &expr, &expr_len, &context, dom_node_class_entry) == FAILURE) { return; } diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c index 6af310e879..0a8830d923 100755 --- a/ext/pdo/pdo.c +++ b/ext/pdo/pdo.c @@ -55,7 +55,7 @@ zend_class_entry *pdo_exception_ce; PDO_API zend_class_entry *php_pdo_get_exception(TSRMLS_D) { - return U_CLASS_ENTRY(pdo_exception_ce); + return pdo_exception_ce; } PDO_API char *php_pdo_str_tolower_dup(const char *src, int len) diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index d66e15cbde..83b4e30ca3 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -508,7 +508,7 @@ static PHP_METHOD(PDO, prepare) RETURN_FALSE; } dbstmt_ce = *pce; - if (!instanceof_function(dbstmt_ce, U_CLASS_ENTRY(pdo_dbstmt_ce) TSRMLS_CC)) { + if (!instanceof_function(dbstmt_ce, pdo_dbstmt_ce TSRMLS_CC)) { pdo_raise_impl_error(dbh, NULL, "HY000", "user-supplied statement class must be derived from PDOStatement" TSRMLS_CC); PDO_HANDLE_DBH_ERR(); @@ -727,7 +727,7 @@ static PHP_METHOD(PDO, setAttribute) PDO_HANDLE_DBH_ERR(); RETURN_FALSE; } - if (!instanceof_function(*pce, U_CLASS_ENTRY(pdo_dbstmt_ce) TSRMLS_CC)) { + if (!instanceof_function(*pce, pdo_dbstmt_ce TSRMLS_CC)) { pdo_raise_impl_error(dbh, NULL, "HY000", "user-supplied statement class must be derived from PDOStatement" TSRMLS_CC); PDO_HANDLE_DBH_ERR(); @@ -1372,7 +1372,7 @@ zend_object_value pdo_dbh_new(zend_class_entry *ce TSRMLS_DC) ALLOC_HASHTABLE(dbh->properties); zend_hash_init(dbh->properties, 0, NULL, ZVAL_PTR_DTOR, 0); zend_hash_copy(dbh->properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); - dbh->def_stmt_ce = U_CLASS_ENTRY(pdo_dbstmt_ce); + dbh->def_stmt_ce = pdo_dbstmt_ce; retval.handle = zend_objects_store_put(dbh, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t)pdo_dbh_free_storage, NULL TSRMLS_CC); retval.handlers = &pdo_dbh_object_handlers; diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 0b60d50a1a..73c33d77f0 100755 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -1178,7 +1178,7 @@ static PHP_METHOD(PDOStatement, fetchObject) switch(ZEND_NUM_ARGS()) { case 0: - stmt->fetch.cls.ce = U_CLASS_ENTRY(zend_standard_class_def); + stmt->fetch.cls.ce = zend_standard_class_def; break; case 2: if (Z_TYPE_P(ctor_args) != IS_NULL && Z_TYPE_P(ctor_args) != IS_ARRAY) { @@ -1274,7 +1274,7 @@ static PHP_METHOD(PDOStatement, fetchAll) switch(ZEND_NUM_ARGS()) { case 0: case 1: - stmt->fetch.cls.ce = U_CLASS_ENTRY(zend_standard_class_def); + stmt->fetch.cls.ce = zend_standard_class_def; break; case 3: if (Z_TYPE_P(ctor_args) != IS_NULL && Z_TYPE_P(ctor_args) != IS_ARRAY) { @@ -2406,7 +2406,7 @@ static union _zend_function *row_get_ctor(zval *object TSRMLS_DC) static zend_class_entry *row_get_ce(zval *object TSRMLS_DC) { - return U_CLASS_ENTRY(pdo_dbstmt_ce); + return pdo_dbstmt_ce; } static int row_get_classname(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC) diff --git a/ext/pdo/php_pdo_phpvers_compat.h b/ext/pdo/php_pdo_phpvers_compat.h index 3746f35074..da46f4947d 100644 --- a/ext/pdo/php_pdo_phpvers_compat.h +++ b/ext/pdo/php_pdo_phpvers_compat.h @@ -27,7 +27,6 @@ # define ZVAL_RT_STRINGL(a, b, c, d) ZVAL_STRINGL(a, b, c, d) # define ZVAL_ASCII_STRINGL(a, b, c, d) ZVAL_STRINGL(a, b, c, d) -# define U_CLASS_ENTRY(ce) ce # define PDO_ZVAL_PP_IS_TEXT(pp) (Z_TYPE_PP(pp) == IS_STRING) # define PDO_ZVAL_P_IS_TEXT(pp) (Z_TYPE_P(pp) == IS_STRING) # define Z_UNIVAL_PP(x) Z_STRVAL_PP(x) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index d4e1de0a0c..c8af4f9b52 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -71,7 +71,7 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection) /* Method macros */ #define METHOD_NOTSTATIC(ce) \ - if (!this_ptr || !instanceof_function(Z_OBJCE_P(this_ptr), U_CLASS_ENTRY(ce) TSRMLS_CC)) { \ + if (!this_ptr || !instanceof_function(Z_OBJCE_P(this_ptr), ce TSRMLS_CC)) { \ zend_error(E_ERROR, "%v() cannot be called statically", get_active_function_name(TSRMLS_C)); \ return; \ } \ @@ -83,11 +83,11 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection) /* Exception throwing macro */ #define _DO_THROW(msg) \ - zend_throw_exception(U_CLASS_ENTRY(reflection_exception_ptr), msg, 0 TSRMLS_CC); \ + zend_throw_exception(reflection_exception_ptr, msg, 0 TSRMLS_CC); \ return; \ #define RETURN_ON_EXCEPTION \ - if (EG(exception) && Z_OBJCE_P(EG(exception)) == U_CLASS_ENTRY(reflection_exception_ptr)) { \ + if (EG(exception) && Z_OBJCE_P(EG(exception)) == reflection_exception_ptr) { \ return; \ } @@ -960,7 +960,7 @@ PHPAPI void zend_reflection_class_factory(zend_class_entry *ce, zval *object TSR MAKE_STD_ZVAL(name); ZVAL_TEXTL(name, ce->name, ce->name_length, 1); - reflection_instanciate(U_CLASS_ENTRY(reflection_class_ptr), object TSRMLS_CC); + reflection_instanciate(reflection_class_ptr, object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); intern->ptr = ce; intern->free_ptr = 0; @@ -986,7 +986,7 @@ static void reflection_extension_factory(zval *object, char *name_str TSRMLS_DC) } free_alloca(lcname); - reflection_instanciate(U_CLASS_ENTRY(reflection_extension_ptr), object TSRMLS_CC); + reflection_instanciate(reflection_extension_ptr, object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); MAKE_STD_ZVAL(name); ZVAL_STRINGL(name, module->name, name_len, 1); @@ -1010,7 +1010,7 @@ static void reflection_parameter_factory(zend_function *fptr, struct _zend_arg_i } else { ZVAL_NULL(name); } - reflection_instanciate(U_CLASS_ENTRY(reflection_parameter_ptr), object TSRMLS_CC); + reflection_instanciate(reflection_parameter_ptr, object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); reference = (parameter_reference*) emalloc(sizeof(parameter_reference)); reference->arg_info = arg_info; @@ -1033,7 +1033,7 @@ static void reflection_function_factory(zend_function *function, zval *object TS MAKE_STD_ZVAL(name); ZVAL_TEXT(name, function->common.function_name, 1); - reflection_instanciate(U_CLASS_ENTRY(reflection_function_ptr), object TSRMLS_CC); + reflection_instanciate(reflection_function_ptr, object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); intern->ptr = function; intern->free_ptr = 0; @@ -1053,7 +1053,7 @@ static void reflection_method_factory(zend_class_entry *ce, zend_function *metho MAKE_STD_ZVAL(classname); ZVAL_TEXT(name, method->common.function_name, 1); ZVAL_TEXTL(classname, ce->name, ce->name_length, 1); - reflection_instanciate(U_CLASS_ENTRY(reflection_method_ptr), object TSRMLS_CC); + reflection_instanciate(reflection_method_ptr, object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); intern->ptr = method; intern->free_ptr = 0; @@ -1091,7 +1091,7 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info ZVAL_TEXT(name, prop_name, 1); ZVAL_TEXTL(classname, ce->name, ce->name_length, 1); - reflection_instanciate(U_CLASS_ENTRY(reflection_property_ptr), object TSRMLS_CC); + reflection_instanciate(reflection_property_ptr, object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); reference = (property_reference*) emalloc(sizeof(property_reference)); reference->ce = ce; @@ -1175,7 +1175,7 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c params[1] = &output_ptr; ZVAL_STRINGL(&fname, "export", sizeof("export") - 1, 0); - fci.function_table = &U_CLASS_ENTRY(reflection_ptr)->function_table; + fci.function_table = &reflection_ptr->function_table; fci.function_name = &fname; fci.object_pp = NULL; fci.retval_ptr_ptr = &retval_ptr; @@ -1218,7 +1218,7 @@ ZEND_METHOD(reflection, export) int result; zend_bool return_output = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &object, U_CLASS_ENTRY(reflector_ptr), &return_output) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &object, reflector_ptr, &return_output) == FAILURE) { return; } @@ -1290,7 +1290,7 @@ ZEND_METHOD(reflection, getModifierNames) Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_function, export) { - _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_function_ptr), 1); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_function_ptr, 1); } /* }}} */ @@ -1320,7 +1320,7 @@ ZEND_METHOD(reflection_function, __construct) lcname = zend_u_str_case_fold(type, name_str, name_len, 1, &lcname_len); if (zend_u_hash_find(EG(function_table), type, lcname, lcname_len + 1, (void **)&fptr) == FAILURE) { efree(lcname); - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Function %R() does not exist", type, name_str); return; } @@ -1511,7 +1511,7 @@ ZEND_METHOD(reflection_function, invoke) efree(params); if (result == FAILURE) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Invocation of function %v() failed", fptr->common.function_name); return; } @@ -1575,7 +1575,7 @@ ZEND_METHOD(reflection_function, invokeArgs) efree(params); if (result == FAILURE) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Invocation of function %v() failed", fptr->common.function_name); return; } @@ -1707,7 +1707,7 @@ ZEND_METHOD(reflection_function, getExtensionName) Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_parameter, export) { - _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_parameter_ptr), 2); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_parameter_ptr, 2); } /* }}} */ @@ -1746,7 +1746,7 @@ ZEND_METHOD(reflection_parameter, __construct) lcname = zend_u_str_case_fold(Z_TYPE_P(reference), Z_UNIVAL_P(reference), Z_UNILEN_P(reference), 1, &lcname_len); if (zend_u_hash_find(EG(function_table), Z_TYPE_P(reference), lcname, lcname_len + 1, (void**) &fptr) == FAILURE) { efree(lcname); - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Function %R() does not exist", Z_TYPE_P(reference), Z_UNIVAL_P(reference)); return; } @@ -1772,7 +1772,7 @@ ZEND_METHOD(reflection_parameter, __construct) } else { convert_to_text_ex(classref); if (zend_u_lookup_class(Z_TYPE_PP(classref), Z_UNIVAL_PP(classref), Z_UNILEN_PP(classref), &pce TSRMLS_CC) == FAILURE) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %R does not exist", Z_TYPE_PP(classref), Z_UNIVAL_PP(classref)); return; } @@ -1783,7 +1783,7 @@ ZEND_METHOD(reflection_parameter, __construct) lcname = zend_u_str_case_fold(Z_TYPE_PP(method), Z_UNIVAL_PP(method), Z_UNILEN_PP(method), 1, &lcname_len); if (zend_u_hash_find(&ce->function_table, Z_TYPE_PP(method), lcname, lcname_len + 1, (void **) &fptr) == FAILURE) { efree(lcname); - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Method %R::%R() does not exist", Z_TYPE_PP(classref), Z_UNIVAL_PP(classref), Z_TYPE_PP(method), Z_UNIVAL_PP(method)); return; } @@ -1881,7 +1881,7 @@ ZEND_METHOD(reflection_parameter, getClass) zend_class_entry **pce; if (zend_u_lookup_class_ex(UG(unicode)?IS_UNICODE:IS_STRING, param->arg_info->class_name, param->arg_info->class_name_len, 1, &pce TSRMLS_CC) == FAILURE) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %v does not exist", param->arg_info->class_name); return; } @@ -1986,16 +1986,16 @@ ZEND_METHOD(reflection_parameter, getDefaultValue) if (param->fptr->type != ZEND_USER_FUNCTION) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Cannot determine default value for internal functions"); + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot determine default value for internal functions"); return; } if (param->offset < param->required) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Parameter is not optional"); + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter is not optional"); return; } precv = _get_recv_op((zend_op_array*)param->fptr, param->offset); if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2.op_type == IS_UNUSED) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Internal error"); + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error"); return; } @@ -2010,7 +2010,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValue) Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_method, export) { - _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_method_ptr), 2); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_method_ptr, 2); } /* }}} */ @@ -2057,7 +2057,7 @@ ZEND_METHOD(reflection_method, __construct) case IS_STRING: case IS_UNICODE: if (zend_u_lookup_class(Z_TYPE_P(classname), Z_UNIVAL_P(classname), Z_UNILEN_P(classname), &pce TSRMLS_CC) == FAILURE) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %v does not exist", Z_UNIVAL_P(classname)); return; } @@ -2086,7 +2086,7 @@ ZEND_METHOD(reflection_method, __construct) if (zend_u_hash_find(&ce->function_table, type, lcname, lcname_len + 1, (void **) &mptr) == FAILURE) { efree(lcname); - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Method %v::%R() does not exist", ce->name, type, name_str); return; } @@ -2144,11 +2144,11 @@ ZEND_METHOD(reflection_method, invoke) if (!(mptr->common.fn_flags & ZEND_ACC_PUBLIC) || (mptr->common.fn_flags & ZEND_ACC_ABSTRACT)) { if (mptr->common.fn_flags & ZEND_ACC_ABSTRACT) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Trying to invoke abstract method %v::%v()", mptr->common.scope->name, mptr->common.function_name); } else { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Trying to invoke %s method %v::%v() from scope %v", mptr->common.fn_flags & ZEND_ACC_PROTECTED ? "protected" : "private", mptr->common.scope->name, mptr->common.function_name, @@ -2209,7 +2209,7 @@ ZEND_METHOD(reflection_method, invoke) efree(params); if (result == FAILURE) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Invocation of method %v::%v() failed", mptr->common.scope->name, mptr->common.function_name); return; } @@ -2247,11 +2247,11 @@ ZEND_METHOD(reflection_method, invokeArgs) if (!(mptr->common.fn_flags & ZEND_ACC_PUBLIC) || (mptr->common.fn_flags & ZEND_ACC_ABSTRACT)) { if (mptr->common.fn_flags & ZEND_ACC_ABSTRACT) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Trying to invoke abstract method %v::%v", mptr->common.scope->name, mptr->common.function_name); } else { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Trying to invoke %s method %v::%v from scope %v", mptr->common.fn_flags & ZEND_ACC_PROTECTED ? "protected" : "private", mptr->common.scope->name, mptr->common.function_name, @@ -2278,7 +2278,7 @@ ZEND_METHOD(reflection_method, invokeArgs) } else { if (!object) { efree(params); - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Trying to invoke non static method %v::%v without an object", mptr->common.scope->name, mptr->common.function_name); return; @@ -2313,7 +2313,7 @@ ZEND_METHOD(reflection_method, invokeArgs) efree(params); if (result == FAILURE) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Invocation of method %v::%v() failed", mptr->common.scope->name, mptr->common.function_name); return; } @@ -2440,7 +2440,7 @@ ZEND_METHOD(reflection_method, getPrototype) GET_REFLECTION_OBJECT_PTR(mptr); if (!mptr->common.prototype) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Method %v::%v does not have a prototype", intern->ce->name, mptr->common.function_name); return; } @@ -2453,7 +2453,7 @@ ZEND_METHOD(reflection_method, getPrototype) Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_class, export) { - _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_class_ptr), 1); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_class_ptr, 1); } /* }}} */ @@ -2495,7 +2495,7 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob convert_to_string_ex(&argument); if (zend_u_lookup_class(Z_TYPE_P(argument), Z_UNIVAL_P(argument), Z_UNILEN_P(argument), &ce TSRMLS_CC) == FAILURE) { if (!EG(exception)) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), -1 TSRMLS_CC, "Class %R does not exist", Z_TYPE_P(argument), Z_UNIVAL_P(argument)); + zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %R does not exist", Z_TYPE_P(argument), Z_UNIVAL_P(argument)); } return; } @@ -2559,7 +2559,7 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue) if (def_value) { RETURN_ZVAL(def_value, 1, 0); } else { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %v does not have a property named %R", ce->name, name_type, name); } return; @@ -2591,7 +2591,7 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue) zend_update_class_constants(ce TSRMLS_CC); variable_ptr = zend_std_get_static_property(ce, name_type, name, name_len, 1 TSRMLS_CC); if (!variable_ptr) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %v does not have a property named %R", ce->name, name_type, name); return; } @@ -2837,7 +2837,7 @@ ZEND_METHOD(reflection_class, getMethod) efree(lc_name); } else { efree(lc_name); - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Method %R does not exist", type, name); return; } @@ -2952,7 +2952,7 @@ ZEND_METHOD(reflection_class, getProperty) if (zend_u_lookup_class(name_type, classname, classname_len, &pce TSRMLS_CC) == FAILURE) { if (!EG(exception)) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), -1 TSRMLS_CC, "Class %R does not exist", name_type, classname); + zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %R does not exist", name_type, classname); } efree(classname); return; @@ -2960,7 +2960,7 @@ ZEND_METHOD(reflection_class, getProperty) efree(classname); if (!instanceof_function(ce, *pce TSRMLS_CC)) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), -1 TSRMLS_CC, "Fully qualified property name %v::%R does not specify a base class of %v", (*pce)->name, name_type, name, ce->name); + zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Fully qualified property name %v::%R does not specify a base class of %v", (*pce)->name, name_type, name, ce->name); return; } ce = *pce; @@ -2970,7 +2970,7 @@ ZEND_METHOD(reflection_class, getProperty) return; } } - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Property %R does not exist", name_type, name); } /* }}} */ @@ -3196,7 +3196,7 @@ ZEND_METHOD(reflection_class, newInstance) zend_fcall_info_cache fcc; if (!(ce->constructor->common.fn_flags & ZEND_ACC_PUBLIC)) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Access to non-public constructor of class %v", ce->name); + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Access to non-public constructor of class %v", ce->name); return; } @@ -3236,7 +3236,7 @@ ZEND_METHOD(reflection_class, newInstance) } else if (!ZEND_NUM_ARGS()) { object_init_ex(return_value, ce); } else { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Class %v does not have a constructor, so you cannot pass any constructor arguments", ce->name); + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %v does not have a constructor, so you cannot pass any constructor arguments", ce->name); } } /* }}} */ @@ -3267,7 +3267,7 @@ ZEND_METHOD(reflection_class, newInstanceArgs) zend_fcall_info_cache fcc; if (!(ce->constructor->common.fn_flags & ZEND_ACC_PUBLIC)) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Access to non-public constructor of class %v", ce->name); + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Access to non-public constructor of class %v", ce->name); return; } @@ -3305,7 +3305,7 @@ ZEND_METHOD(reflection_class, newInstanceArgs) } else if (!ZEND_NUM_ARGS()) { object_init_ex(return_value, ce); } else { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Class %v does not have a constructor, so you cannot pass any constructor arguments", ce->name); + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %v does not have a constructor, so you cannot pass any constructor arguments", ce->name); } } /* }}} */ @@ -3373,14 +3373,14 @@ ZEND_METHOD(reflection_class, isSubclassOf) case IS_STRING: case IS_UNICODE: if (zend_u_lookup_class(Z_TYPE_P(class_name), Z_UNIVAL_P(class_name), Z_UNILEN_P(class_name), &pce TSRMLS_CC) == FAILURE) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Interface %R does not exist", Z_TYPE_P(class_name), Z_UNIVAL_P(class_name)); return; } class_ce = *pce; break; case IS_OBJECT: - if (instanceof_function(Z_OBJCE_P(class_name), U_CLASS_ENTRY(reflection_class_ptr) TSRMLS_CC)) { + if (instanceof_function(Z_OBJCE_P(class_name), reflection_class_ptr TSRMLS_CC)) { argument = (reflection_object *) zend_object_store_get_object(class_name TSRMLS_CC); if (argument == NULL || argument->ptr == NULL) { zend_error(E_ERROR, "Internal error: Failed to retrieve the argument's reflection object"); @@ -3391,7 +3391,7 @@ ZEND_METHOD(reflection_class, isSubclassOf) } /* no break */ default: - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter one must either be a string or a ReflectionClass object"); return; } @@ -3420,14 +3420,14 @@ ZEND_METHOD(reflection_class, implementsInterface) case IS_STRING: case IS_UNICODE: if (zend_u_lookup_class(Z_TYPE_P(interface), Z_UNIVAL_P(interface), Z_UNILEN_P(interface), &pce TSRMLS_CC) == FAILURE) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Interface %R does not exist", Z_TYPE_P(interface), Z_UNIVAL_P(interface)); return; } interface_ce = *pce; break; case IS_OBJECT: - if (instanceof_function(Z_OBJCE_P(interface), U_CLASS_ENTRY(reflection_class_ptr) TSRMLS_CC)) { + if (instanceof_function(Z_OBJCE_P(interface), reflection_class_ptr TSRMLS_CC)) { argument = (reflection_object *) zend_object_store_get_object(interface TSRMLS_CC); if (argument == NULL || argument->ptr == NULL) { zend_error(E_ERROR, "Internal error: Failed to retrieve the argument's reflection object"); @@ -3438,13 +3438,13 @@ ZEND_METHOD(reflection_class, implementsInterface) } /* no break */ default: - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter one must either be a string or a ReflectionClass object"); return; } if (!(interface_ce->ce_flags & ZEND_ACC_INTERFACE)) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Interface %v is a Class", interface_ce->name); return; } @@ -3504,7 +3504,7 @@ ZEND_METHOD(reflection_class, getExtensionName) Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_object, export) { - _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_object_ptr), 1); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_object_ptr, 1); } /* }}} */ @@ -3520,7 +3520,7 @@ ZEND_METHOD(reflection_object, __construct) Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_property, export) { - _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_property_ptr), 2); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_property_ptr, 2); } /* }}} */ @@ -3554,7 +3554,7 @@ ZEND_METHOD(reflection_property, __construct) case IS_STRING: case IS_UNICODE: if (zend_u_lookup_class(Z_TYPE_P(classname), Z_UNIVAL_P(classname), Z_UNILEN_P(classname), &pce TSRMLS_CC) == FAILURE) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %R does not exist", Z_TYPE_P(classname), Z_UNIVAL_P(classname)); return; } @@ -3571,7 +3571,7 @@ ZEND_METHOD(reflection_property, __construct) } if (zend_u_hash_find(&ce->properties_info, name_type, name_str, name_len + 1, (void **) &property_info) == FAILURE || (property_info->flags & ZEND_ACC_SHADOW)) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Property %v::$%R does not exist", ce->name, name_type, name_str); return; } @@ -3839,7 +3839,7 @@ ZEND_METHOD(reflection_property, getDocComment) Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_extension, export) { - _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_extension_ptr), 1); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_extension_ptr, 1); } /* }}} */ @@ -3868,7 +3868,7 @@ ZEND_METHOD(reflection_extension, __construct) zend_str_tolower_copy(lcname, name_str, name_len); if (zend_hash_find(&module_registry, lcname, name_len + 1, (void **)&module) == FAILURE) { free_alloca(lcname); - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Extension %s does not exist", name_str); return; } @@ -4248,7 +4248,7 @@ static void _reflection_write_property(zval *object, zval *member, zval *value T && (ZEND_U_EQUAL(Z_TYPE_P(member), Z_UNIVAL_P(member), Z_UNILEN_P(member), "name", sizeof("name")-1) || ZEND_U_EQUAL(Z_TYPE_P(member), Z_UNIVAL_P(member), Z_UNILEN_P(member), "class", sizeof("class")-1))) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot set read-only property %v::$%R", Z_OBJCE_P(object)->name, Z_TYPE_P(member), Z_UNIVAL_P(member)); } else diff --git a/ext/session/tests/015.phpt b/ext/session/tests/015.phpt index e747e08fbd..e0afb43db1 100644 --- a/ext/session/tests/015.phpt +++ b/ext/session/tests/015.phpt @@ -6,7 +6,7 @@ use_trans_sid should not affect SID session.use_trans_sid=1 session.use_cookies=0 session.cache_limiter= -arg_separator.output=& +arg_separator.output="&" session.name=PHPSESSID session.serialize_handler=php session.save_handler=files diff --git a/ext/session/tests/020.phpt b/ext/session/tests/020.phpt index 455c7f7204..82997a8f04 100644 --- a/ext/session/tests/020.phpt +++ b/ext/session/tests/020.phpt @@ -6,7 +6,7 @@ rewriter uses arg_seperator.output for modifying URLs session.use_cookies=0 session.cache_limiter= session.use_trans_sid=1 -arg_separator.output=& +arg_separator.output="&" session.name=PHPSESSID session.serialize_handler=php session.save_handler=files diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 6e7a997aa6..487c7d0d8f 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -44,7 +44,7 @@ zend_class_entry *sxe_class_entry = NULL; ZEND_API zend_class_entry *sxe_get_element_class_entry(TSRMLS_D) { - return U_CLASS_ENTRY(sxe_class_entry); + return sxe_class_entry; } #define SXE_ME(func, arg_info, flags) PHP_ME(simplexml_element, func, arg_info, flags) @@ -1585,7 +1585,7 @@ PHP_FUNCTION(simplexml_load_file) char *classname = ""; int classname_len = 0; long options = 0; - zend_class_entry *ce= U_CLASS_ENTRY(sxe_class_entry); + zend_class_entry *ce= sxe_class_entry; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sl", &filename, &filename_len, &classname, &classname_len, &options) == FAILURE) { return; @@ -1629,7 +1629,7 @@ PHP_FUNCTION(simplexml_load_string) char *classname = ""; int classname_len = 0; long options = 0; - zend_class_entry *ce= U_CLASS_ENTRY(sxe_class_entry); + zend_class_entry *ce= sxe_class_entry; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sl", &data, &data_len, &classname, &classname_len, &options) == FAILURE) { return; @@ -1896,7 +1896,7 @@ PHP_FUNCTION(simplexml_import_dom) xmlNodePtr nodep = NULL; char *classname = ""; int classname_len = 0; - zend_class_entry *ce= U_CLASS_ENTRY(sxe_class_entry); + zend_class_entry *ce= sxe_class_entry; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|s", &node, &classname, &classname_len) == FAILURE) { return; diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index c5ab4a10df..23a3290fac 100755 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -145,7 +145,7 @@ PHP_FUNCTION(class_implements) /* }}} */ #define SPL_ADD_CLASS(class_name, z_list, sub, allow, ce_flags) \ - spl_add_classes(U_CLASS_ENTRY(spl_ce_ ## class_name), z_list, sub, allow, ce_flags TSRMLS_CC) + spl_add_classes(spl_ce_ ## class_name, z_list, sub, allow, ce_flags TSRMLS_CC) #define SPL_LIST_CLASSES(z_list, sub, allow, ce_flags) \ SPL_ADD_CLASS(AppendIterator, z_list, sub, allow, ce_flags); \ @@ -298,7 +298,7 @@ PHP_FUNCTION(spl_autoload) EG(function_state_ptr) = original_function_state_ptr; if (!found) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Class %s could not be loaded", class_name); + zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Class %s could not be loaded", class_name); } } /* }}} */ @@ -420,25 +420,25 @@ PHP_FUNCTION(spl_autoload_register) if (Z_TYPE_P(zcallable) == IS_ARRAY) { if (!obj_ptr && alfi.func_ptr && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) { if (do_throw) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Passed array specifies a non static method but no object"); + zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Passed array specifies a non static method but no object"); } zval_dtor(&zfunc_name); return; } else if (do_throw) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Passed array does not specify %s %smethod", alfi.func_ptr ? "a callable" : "an existing", !obj_ptr ? "static " : ""); + zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Passed array does not specify %s %smethod", alfi.func_ptr ? "a callable" : "an existing", !obj_ptr ? "static " : ""); } zval_dtor(&zfunc_name); return; } else if (Z_TYPE_P(zcallable) == IS_STRING || Z_TYPE_P(zcallable) == IS_UNICODE) { if (do_throw) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Function '%R' not %s", Z_TYPE_P(zcallable), Z_UNIVAL_P(zcallable), alfi.func_ptr ? "callable" : "found"); + zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Function '%R' not %s", Z_TYPE_P(zcallable), Z_UNIVAL_P(zcallable), alfi.func_ptr ? "callable" : "found"); } zval_dtor(&zfunc_name); return; } else { if (do_throw) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Illegal value passed"); + zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Illegal value passed"); } zval_dtor(&zfunc_name); return; diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 45f7a246d2..34d00328dd 100755 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -156,11 +156,11 @@ static zend_object_value spl_array_object_new_ex(zend_class_entry *class_type, s retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) spl_array_object_free_storage, NULL TSRMLS_CC); while (parent) { - if (parent == U_CLASS_ENTRY(spl_ce_ArrayIterator) || parent == U_CLASS_ENTRY(spl_ce_RecursiveArrayIterator)) { + if (parent == spl_ce_ArrayIterator || parent == spl_ce_RecursiveArrayIterator) { retval.handlers = &spl_handler_ArrayIterator; class_type->get_iterator = spl_array_get_iterator; break; - } else if (parent == U_CLASS_ENTRY(spl_ce_ArrayObject)) { + } else if (parent == spl_ce_ArrayObject) { retval.handlers = &spl_handler_ArrayObject; break; } @@ -207,7 +207,7 @@ static zend_object_value spl_array_object_new_ex(zend_class_entry *class_type, s } } - intern->ce_get_iterator = U_CLASS_ENTRY(spl_ce_ArrayIterator); + intern->ce_get_iterator = spl_ce_ArrayIterator; zend_hash_internal_pointer_reset_ex(spl_array_get_hash_table(intern, 0 TSRMLS_CC), &intern->pos); return retval; } @@ -332,7 +332,7 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval case IS_STRING: case IS_UNICODE: if (*(char*)Z_UNIVAL_P(offset) == '\0') { - zend_throw_exception(U_CLASS_ENTRY(spl_ce_InvalidArgumentException), "An offset must not begin with \\0 or be empty", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_InvalidArgumentException, "An offset must not begin with \\0 or be empty", 0 TSRMLS_CC); return; } value->refcount++; @@ -845,7 +845,7 @@ SPL_METHOD(Array, __construct) if (ZEND_NUM_ARGS() == 0) { return; /* nothing to do */ } - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_InvalidArgumentException) TSRMLS_CC); + php_set_error_handling(EH_THROW, spl_ce_InvalidArgumentException TSRMLS_CC); intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); @@ -856,7 +856,7 @@ SPL_METHOD(Array, __construct) if (ZEND_NUM_ARGS() > 2) { if (zend_lookup_class(class_name, class_name_len, &pce_get_iterator TSRMLS_CC) == FAILURE) { - zend_throw_exception(U_CLASS_ENTRY(spl_ce_InvalidArgumentException), "A class that implements Iterator must be specified", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_InvalidArgumentException, "A class that implements Iterator must be specified", 0 TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return; } @@ -877,7 +877,7 @@ SPL_METHOD(Array, __construct) } else { if (Z_TYPE_P(array) != IS_OBJECT && Z_TYPE_P(array) != IS_ARRAY) { php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); - zend_throw_exception(U_CLASS_ENTRY(spl_ce_InvalidArgumentException), "Passed variable is not an array or object, using empty array instead", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_InvalidArgumentException, "Passed variable is not an array or object, using empty array instead", 0 TSRMLS_CC); return; } zval_ptr_dtor(&intern->array); @@ -895,7 +895,7 @@ SPL_METHOD(Array, __construct) if ((handler != std_object_handlers.get_properties && handler != spl_array_get_properties) || !spl_array_get_hash_table(intern, 0 TSRMLS_CC)) { php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_InvalidArgumentException), 0 TSRMLS_CC, "Overloaded object of type %s is not compatible with %s", Z_OBJCE_P(array)->name, intern->std.ce->name); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Overloaded object of type %s is not compatible with %s", Z_OBJCE_P(array)->name, intern->std.ce->name); return; } } @@ -922,7 +922,7 @@ SPL_METHOD(Array, setIteratorClass) } if (zend_lookup_class(class_name, class_name_len, &pce_get_iterator TSRMLS_CC) == FAILURE) { - zend_throw_exception(U_CLASS_ENTRY(spl_ce_InvalidArgumentException), "A class that implements Iterator must be specified", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_InvalidArgumentException, "A class that implements Iterator must be specified", 0 TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return; } @@ -992,7 +992,7 @@ SPL_METHOD(Array, exchangeArray) intern->array = other->array; } else { if (Z_TYPE_PP(array) != IS_OBJECT && !HASH_OF(*array)) { - zend_throw_exception(U_CLASS_ENTRY(spl_ce_InvalidArgumentException), "Passed variable is not an array or object, using empty array instead", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_InvalidArgumentException, "Passed variable is not an array or object, using empty array instead", 0 TSRMLS_CC); return; } zval_ptr_dtor(&intern->array); @@ -1072,7 +1072,7 @@ SPL_METHOD(Array, seek) return; /* ok */ } } - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_OutOfBoundsException), 0 TSRMLS_CC, "Seek position %ld is out of range", opos); + zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Seek position %ld is out of range", opos); } /* }}} */ int spl_array_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */ @@ -1127,7 +1127,7 @@ static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fnam if (use_arg) { if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) { - zend_throw_exception(U_CLASS_ENTRY(spl_ce_BadMethodCallException), "Function expects exactly one argument", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_BadMethodCallException, "Function expects exactly one argument", 0 TSRMLS_CC); return; } zend_call_method(NULL, NULL, NULL, fname, fname_len, &return_value, 2, &tmp, arg TSRMLS_CC); diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 0e952ca392..04f72be878 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -131,8 +131,8 @@ static zend_object_value spl_filesystem_object_new_ex(zend_class_entry *class_ty memset(intern, 0, sizeof(spl_filesystem_object)); intern->std.ce = class_type; /* intern->type = SPL_FS_INFO; done by set o */ - intern->file_class = U_CLASS_ENTRY(spl_ce_SplFileObject); - intern->info_class = U_CLASS_ENTRY(spl_ce_SplFileInfo); + intern->file_class = spl_ce_SplFileObject; + intern->info_class = spl_ce_SplFileInfo; if (obj) *obj = intern; ALLOC_HASHTABLE(intern->std.properties); @@ -206,7 +206,7 @@ static int spl_filesystem_file_open(spl_filesystem_object *intern, int use_inclu if (intern->u.file.stream == NULL) { if (!EG(exception)) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, "Cannot open file %s", intern->file_name); + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot open file %s", intern->file_name); } intern->file_name = NULL; /* until here it is not a copy */ intern->u.file.open_mode = NULL; @@ -301,7 +301,7 @@ static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_ spl_filesystem_object *intern; if (!file_path || !file_path_len) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, "Cannot create SplFileInfo for empty path"); + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot create SplFileInfo for empty path"); if (file_path && !use_copy) { efree(file_path); @@ -309,7 +309,7 @@ static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_ return NULL; } - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_RuntimeException) TSRMLS_CC); + php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); return_value->value.obj = spl_filesystem_object_new_ex(ce ? ce : source->info_class, &intern TSRMLS_CC); Z_TYPE_P(return_value) = IS_OBJECT; @@ -326,7 +326,7 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil spl_filesystem_object *intern; zend_bool use_include_path = 0; - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_RuntimeException) TSRMLS_CC); + php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); switch (source->type) { case SPL_FS_INFO: @@ -334,7 +334,7 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil break; case SPL_FS_DIR: if (!source->u.dir.entry.d_name[0]) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, "Could not open file"); + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Could not open file"); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return NULL; } @@ -381,7 +381,7 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil break; case SPL_FS_DIR: php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, "Operation not supported"); + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Operation not supported"); return NULL; } php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); @@ -396,7 +396,7 @@ SPL_METHOD(DirectoryIterator, __construct) char *path; int len; - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_RuntimeException) TSRMLS_CC); + php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &len) == FAILURE) { php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); @@ -411,7 +411,7 @@ SPL_METHOD(DirectoryIterator, __construct) intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); spl_filesystem_dir_open(intern, path TSRMLS_CC); - intern->u.dir.is_recursive = instanceof_function(intern->std.ce, U_CLASS_ENTRY(spl_ce_RecursiveDirectoryIterator) TSRMLS_CC) ? 1 : 0; + intern->u.dir.is_recursive = instanceof_function(intern->std.ce, spl_ce_RecursiveDirectoryIterator TSRMLS_CC) ? 1 : 0; intern->flags = 0; php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); @@ -596,7 +596,7 @@ SPL_METHOD(SplFileInfo, __construct) char *path; int len; - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_RuntimeException) TSRMLS_CC); + php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &len) == FAILURE) { php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); @@ -714,7 +714,7 @@ SPL_METHOD(SplFileInfo, openFile) SPL_METHOD(SplFileInfo, setFileClass) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - zend_class_entry *ce = U_CLASS_ENTRY(spl_ce_SplFileObject); + zend_class_entry *ce = spl_ce_SplFileObject; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) == FAILURE) { return; @@ -729,7 +729,7 @@ SPL_METHOD(SplFileInfo, setFileClass) SPL_METHOD(SplFileInfo, setInfoClass) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - zend_class_entry *ce = U_CLASS_ENTRY(spl_ce_SplFileInfo); + zend_class_entry *ce = spl_ce_SplFileInfo; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) == FAILURE) { return; @@ -778,7 +778,7 @@ SPL_METHOD(RecursiveDirectoryIterator, __construct) int len; long flags = SPL_FILE_DIR_CURRENT_AS_FILEINFO; - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_RuntimeException) TSRMLS_CC); + php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &len, &flags) == FAILURE) { php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); @@ -787,7 +787,7 @@ SPL_METHOD(RecursiveDirectoryIterator, __construct) intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); spl_filesystem_dir_open(intern, path TSRMLS_CC); - intern->u.dir.is_recursive = instanceof_function(intern->std.ce, U_CLASS_ENTRY(spl_ce_RecursiveDirectoryIterator) TSRMLS_CC) ? 1 : 0; + intern->u.dir.is_recursive = instanceof_function(intern->std.ce, spl_ce_RecursiveDirectoryIterator TSRMLS_CC) ? 1 : 0; intern->flags = flags; php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); @@ -869,7 +869,7 @@ SPL_METHOD(RecursiveDirectoryIterator, getChildren) INIT_PZVAL(&zpath); ZVAL_STRINGL(&zpath, intern->file_name, intern->file_name_len, 0); - spl_instantiate_arg_ex1(U_CLASS_ENTRY(spl_ce_RecursiveDirectoryIterator), &return_value, 0, &zpath TSRMLS_CC); + spl_instantiate_arg_ex1(spl_ce_RecursiveDirectoryIterator, &return_value, 0, &zpath TSRMLS_CC); subdir = (spl_filesystem_object*)zend_object_store_get_object(return_value TSRMLS_CC); if (subdir) { @@ -1317,7 +1317,7 @@ static int spl_filesystem_file_read(spl_filesystem_object *intern, int silent TS if (php_stream_eof(intern->u.file.stream)) { if (!silent) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, "Cannot read from file %s", intern->file_name); + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot read from file %s", intern->file_name); } return FAILURE; } @@ -1351,10 +1351,10 @@ static int spl_filesystem_file_read_line(zval * this_ptr, spl_filesystem_object zval *retval; /* if overloaded call the function, otherwise do it directly */ - if (intern->u.file.func_getCurr->common.scope != U_CLASS_ENTRY(spl_ce_SplFileObject)) { + if (intern->u.file.func_getCurr->common.scope != spl_ce_SplFileObject) { if (php_stream_eof(intern->u.file.stream)) { if (!silent) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, "Cannot read from file %s", intern->file_name); + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot read from file %s", intern->file_name); } return FAILURE; } @@ -1384,7 +1384,7 @@ static int spl_filesystem_file_read_line(zval * this_ptr, spl_filesystem_object static void spl_filesystem_file_rewind(spl_filesystem_object *intern TSRMLS_DC) /* {{{ */ { if (-1 == php_stream_rewind(intern->u.file.stream)) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, "Cannot rewind file %s", intern->file_name); + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot rewind file %s", intern->file_name); } else { spl_filesystem_file_free_line(intern TSRMLS_CC); intern->u.file.current_line_num = 0; @@ -1399,7 +1399,7 @@ SPL_METHOD(SplFileObject, __construct) zend_bool use_include_path = 0; char *p1, *p2; - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_RuntimeException) TSRMLS_CC); + php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); intern->u.file.open_mode = "r"; intern->u.file.open_mode_len = 1; @@ -1438,7 +1438,7 @@ SPL_METHOD(SplTempFileObject, __construct) char tmp_fname[48]; spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_RuntimeException) TSRMLS_CC); + php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &max_memory) == FAILURE) { php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); @@ -1586,7 +1586,7 @@ SPL_METHOD(SplFileObject, setMaxLineLen) } if (max_len < 0) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_DomainException), 0 TSRMLS_CC, "Maximum line length must be greater than or equal zero"); + zend_throw_exception_ex(spl_ce_DomainException, 0 TSRMLS_CC, "Maximum line length must be greater than or equal zero"); return; } @@ -1850,7 +1850,7 @@ SPL_METHOD(SplFileObject, ftruncate) } if (!php_stream_truncate_supported(intern->u.file.stream)) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Can't truncate file %s", intern->file_name); + zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Can't truncate file %s", intern->file_name); RETURN_FALSE; } @@ -1868,7 +1868,7 @@ SPL_METHOD(SplFileObject, seek) return; } if (line_pos < 0) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Can't seek file %s to negative line %ld", intern->file_name, line_pos); + zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Can't seek file %s to negative line %ld", intern->file_name, line_pos); RETURN_FALSE; } diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 0f7a40d657..7282004929 100755 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -265,11 +265,11 @@ next_step: } ce = child && Z_TYPE_P(child) == IS_OBJECT ? Z_OBJCE_P(child) : NULL; - if (!ce || !instanceof_function(ce, U_CLASS_ENTRY(spl_ce_RecursiveIterator) TSRMLS_CC)) { + if (!ce || !instanceof_function(ce, spl_ce_RecursiveIterator TSRMLS_CC)) { if (child) { zval_ptr_dtor(&child); } - zend_throw_exception(U_CLASS_ENTRY(spl_ce_UnexpectedValueException), "Objects returned by RecursiveIterator::getChildren() must implement RecursiveIterator", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_UnexpectedValueException, "Objects returned by RecursiveIterator::getChildren() must implement RecursiveIterator", 0 TSRMLS_CC); return; } if (object->mode == RIT_CHILD_FIRST) { @@ -313,7 +313,7 @@ static void spl_recursive_it_rewind_ex(spl_recursive_it_object *object, zval *zt sub_iter = object->iterators[object->level].iterator; sub_iter->funcs->dtor(sub_iter TSRMLS_CC); zval_ptr_dtor(&object->iterators[object->level--].zobject); - if (!object->endChildren || object->endChildren->common.scope != U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { + if (!object->endChildren || object->endChildren->common.scope != spl_ce_RecursiveIteratorIterator) { zend_call_method_with_0_params(&zthis, object->ce, &object->endChildren, "endchildren", NULL); } } @@ -378,10 +378,10 @@ SPL_METHOD(RecursiveIteratorIterator, __construct) long mode = RIT_LEAVES_ONLY, flags = 0; int inc_refcount = 1; - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_InvalidArgumentException) TSRMLS_CC); + php_set_error_handling(EH_THROW, spl_ce_InvalidArgumentException TSRMLS_CC); if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|ll", &iterator, &mode, &flags) == SUCCESS) { - if (instanceof_function(Z_OBJCE_P(iterator), U_CLASS_ENTRY(zend_ce_aggregate) TSRMLS_CC)) { + if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate TSRMLS_CC)) { zval *aggregate = iterator; zend_call_method_with_0_params(&aggregate, Z_OBJCE_P(aggregate), &Z_OBJCE_P(aggregate)->iterator_funcs.zf_new_iterator, "getiterator", &iterator); inc_refcount = 0; @@ -389,12 +389,12 @@ SPL_METHOD(RecursiveIteratorIterator, __construct) } else { iterator = NULL; } - if (!iterator || !instanceof_function(Z_OBJCE_P(iterator), U_CLASS_ENTRY(spl_ce_RecursiveIterator) TSRMLS_CC)) { + if (!iterator || !instanceof_function(Z_OBJCE_P(iterator), spl_ce_RecursiveIterator TSRMLS_CC)) { if (iterator && !inc_refcount) { zval_ptr_dtor(&iterator); } php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); - zend_throw_exception(U_CLASS_ENTRY(spl_ce_InvalidArgumentException), "An instance of RecursiveIterator or IteratorAggregate creating it is required", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_InvalidArgumentException, "An instance of RecursiveIterator or IteratorAggregate creating it is required", 0 TSRMLS_CC); return; } @@ -408,31 +408,31 @@ SPL_METHOD(RecursiveIteratorIterator, __construct) intern->ce = Z_OBJCE_P(object); zend_hash_find(&intern->ce->function_table, "beginiteration", sizeof("beginiteration"), (void **) &intern->beginIteration); - if (intern->beginIteration->common.scope == U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { + if (intern->beginIteration->common.scope == spl_ce_RecursiveIteratorIterator) { intern->beginIteration = NULL; } zend_hash_find(&intern->ce->function_table, "enditeration", sizeof("enditeration"), (void **) &intern->endIteration); - if (intern->endIteration->common.scope == U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { + if (intern->endIteration->common.scope == spl_ce_RecursiveIteratorIterator) { intern->endIteration = NULL; } zend_hash_find(&intern->ce->function_table, "callhaschildren", sizeof("callHasChildren"), (void **) &intern->callHasChildren); - if (intern->callHasChildren->common.scope == U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { + if (intern->callHasChildren->common.scope == spl_ce_RecursiveIteratorIterator) { intern->callHasChildren = NULL; } zend_hash_find(&intern->ce->function_table, "callgetchildren", sizeof("callGetChildren"), (void **) &intern->callGetChildren); - if (intern->callGetChildren->common.scope == U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { + if (intern->callGetChildren->common.scope == spl_ce_RecursiveIteratorIterator) { intern->callGetChildren = NULL; } zend_hash_find(&intern->ce->function_table, "beginchildren", sizeof("beginchildren"), (void **) &intern->beginChildren); - if (intern->beginChildren->common.scope == U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { + if (intern->beginChildren->common.scope == spl_ce_RecursiveIteratorIterator) { intern->beginChildren = NULL; } zend_hash_find(&intern->ce->function_table, "endchildren", sizeof("endchildren"), (void **) &intern->endChildren); - if (intern->endChildren->common.scope == U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { + if (intern->endChildren->common.scope == spl_ce_RecursiveIteratorIterator) { intern->endChildren = NULL; } zend_hash_find(&intern->ce->function_table, "nextelement", sizeof("nextElement"), (void **) &intern->nextElement); - if (intern->nextElement->common.scope == U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { + if (intern->nextElement->common.scope == spl_ce_RecursiveIteratorIterator) { intern->nextElement = NULL; } ce_iterator = Z_OBJCE_P(iterator); /* respect inheritance, don't use spl_ce_RecursiveIterator */ @@ -633,7 +633,7 @@ SPL_METHOD(RecursiveIteratorIterator, setMaxDepth) return; } if (max_depth < -1) { - zend_throw_exception(U_CLASS_ENTRY(spl_ce_OutOfRangeException), "Parameter max_depth must be >= -1", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_OutOfRangeException, "Parameter max_depth must be >= -1", 0 TSRMLS_CC); return; } object->max_depth = max_depth; @@ -842,7 +842,7 @@ static inline spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAME int inc_refcount = 1; - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_InvalidArgumentException) TSRMLS_CC); + php_set_error_handling(EH_THROW, spl_ce_InvalidArgumentException TSRMLS_CC); intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); @@ -857,12 +857,12 @@ static inline spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAME } if (intern->u.limit.offset < 0) { php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); - zend_throw_exception(U_CLASS_ENTRY(spl_ce_OutOfRangeException), "Parameter offset must be > 0", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_OutOfRangeException, "Parameter offset must be > 0", 0 TSRMLS_CC); return NULL; } if (intern->u.limit.count < 0 && intern->u.limit.count != -1) { php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); - zend_throw_exception(U_CLASS_ENTRY(spl_ce_OutOfRangeException), "Parameter count must either be -1 or a value greater than or equal 0", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_OutOfRangeException, "Parameter count must either be -1 or a value greater than or equal 0", 0 TSRMLS_CC); return NULL; } break; @@ -877,7 +877,7 @@ static inline spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAME if (((flags & CIT_CALL_TOSTRING) && (flags & (CIT_TOSTRING_USE_KEY|CIT_TOSTRING_USE_CURRENT))) || ((flags & (CIT_TOSTRING_USE_KEY|CIT_TOSTRING_USE_CURRENT)) == (CIT_TOSTRING_USE_KEY|CIT_TOSTRING_USE_CURRENT))) { php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); - zend_throw_exception(U_CLASS_ENTRY(spl_ce_InvalidArgumentException), "Flags must contain only one of CATCH_GET_CHILD, CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_InvalidArgumentException, "Flags must contain only one of CATCH_GET_CHILD, CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT", 0 TSRMLS_CC); return NULL; } intern->u.caching.flags |= flags & CIT_PUBLIC; @@ -895,22 +895,22 @@ static inline spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAME return NULL; } ce = Z_OBJCE_P(zobject); - if (!instanceof_function(ce, U_CLASS_ENTRY(zend_ce_iterator) TSRMLS_CC)) { + if (!instanceof_function(ce, zend_ce_iterator TSRMLS_CC)) { if (ZEND_NUM_ARGS() > 1) { if (zend_lookup_class(class_name, class_name_len, &pce_cast TSRMLS_CC) == FAILURE || !instanceof_function(ce, *pce_cast TSRMLS_CC) || !(*pce_cast)->get_iterator ) { - zend_throw_exception(U_CLASS_ENTRY(spl_ce_LogicException), "Class to downcast to not found or not base class or does not implement Traversable", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_LogicException, "Class to downcast to not found or not base class or does not implement Traversable", 0 TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return NULL; } ce = *pce_cast; } - if (instanceof_function(ce, U_CLASS_ENTRY(zend_ce_aggregate) TSRMLS_CC)) { + if (instanceof_function(ce, zend_ce_aggregate TSRMLS_CC)) { zend_call_method_with_0_params(&zobject, ce, &ce->iterator_funcs.zf_new_iterator, "getiterator", &retval); - if (!retval || Z_TYPE_P(retval) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(retval), U_CLASS_ENTRY(zend_ce_traversable) TSRMLS_CC)) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "%s::getIterator() must return an object that implememnts Traversable", ce->name); + if (!retval || Z_TYPE_P(retval) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(retval), zend_ce_traversable TSRMLS_CC)) { + zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "%s::getIterator() must return an object that implememnts Traversable", ce->name); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return NULL; } @@ -922,9 +922,9 @@ static inline spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAME break; } case DIT_AppendIterator: - spl_instantiate(U_CLASS_ENTRY(spl_ce_ArrayIterator), &intern->u.append.zarrayit, 1 TSRMLS_CC); - zend_call_method_with_0_params(&intern->u.append.zarrayit, U_CLASS_ENTRY(spl_ce_ArrayIterator), &U_CLASS_ENTRY(spl_ce_ArrayIterator)->constructor, "__construct", NULL); - intern->u.append.iterator = U_CLASS_ENTRY(spl_ce_ArrayIterator)->get_iterator(U_CLASS_ENTRY(spl_ce_ArrayIterator), intern->u.append.zarrayit, 0 TSRMLS_CC); + spl_instantiate(spl_ce_ArrayIterator, &intern->u.append.zarrayit, 1 TSRMLS_CC); + zend_call_method_with_0_params(&intern->u.append.zarrayit, spl_ce_ArrayIterator, &spl_ce_ArrayIterator->constructor, "__construct", NULL); + intern->u.append.iterator = spl_ce_ArrayIterator->get_iterator(spl_ce_ArrayIterator, intern->u.append.zarrayit, 0 TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return intern; #if HAVE_PCRE || HAVE_BUNDLED_PCRE @@ -970,7 +970,7 @@ static inline spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAME Create an Iterator from another iterator */ SPL_METHOD(dual_it, __construct) { - spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_iterator), DIT_Default); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_iterator, DIT_Default); } /* }}} */ /* {{{ proto Iterator FilterIterator::getInnerIterator() @@ -1212,7 +1212,7 @@ SPL_METHOD(FilterIterator, next) Create a RecursiveFilterIterator from a RecursiveIterator */ SPL_METHOD(RecursiveFilterIterator, __construct) { - spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(spl_ce_RecursiveIterator), DIT_Default); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_RecursiveIterator, DIT_Default); } /* }}} */ /* {{{ proto boolean RecursiveFilterIterator::hasChildren() @@ -1246,7 +1246,7 @@ SPL_METHOD(RecursiveFilterIterator, getChildren) Create a ParentIterator from a RecursiveIterator */ SPL_METHOD(ParentIterator, __construct) { - spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(spl_ce_RecursiveIterator), DIT_Default); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_RecursiveIterator, DIT_Default); } /* }}} */ /* {{{ proto boolean ParentIterator::hasChildren() @@ -1281,7 +1281,7 @@ SPL_METHOD(ParentIterator, getChildren) Create an RegExIterator from another iterator and a regular expression */ SPL_METHOD(RegExIterator, __construct) { - spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_iterator), DIT_RegExIterator); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_iterator, DIT_RegExIterator); } /* }}} */ /* {{{ proto bool RegExIterator::accept() @@ -1330,7 +1330,7 @@ SPL_METHOD(RegExIterator, accept) Create an RecursiveRegExIterator from another recursive iterator and a regular expression */ SPL_METHOD(RecursiveRegExIterator, __construct) { - spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(spl_ce_RecursiveIterator), DIT_RecursiveRegExIterator); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_RecursiveIterator, DIT_RecursiveRegExIterator); } /* }}} */ #endif @@ -1473,14 +1473,14 @@ static inline void spl_limit_it_seek(spl_dual_it_object *intern, long pos TSRMLS spl_dual_it_free(intern TSRMLS_CC); if (pos < intern->u.limit.offset) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_OutOfBoundsException), 0 TSRMLS_CC, "Cannot seek to %ld which is below the offset %ld", pos, intern->u.limit.offset); + zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %ld which is below the offset %ld", pos, intern->u.limit.offset); return; } if (pos > intern->u.limit.offset + intern->u.limit.count && intern->u.limit.count != -1) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_OutOfBoundsException), 0 TSRMLS_CC, "Cannot seek to %ld which is behind offest %ld plus count %ld", pos, intern->u.limit.offset, intern->u.limit.count); + zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %ld which is behind offest %ld plus count %ld", pos, intern->u.limit.offset, intern->u.limit.count); return; } - if (instanceof_function(intern->inner.ce, U_CLASS_ENTRY(spl_ce_SeekableIterator) TSRMLS_CC)) { + if (instanceof_function(intern->inner.ce, spl_ce_SeekableIterator TSRMLS_CC)) { MAKE_STD_ZVAL(zpos); ZVAL_LONG(zpos, pos); spl_dual_it_free(intern TSRMLS_CC); @@ -1509,7 +1509,7 @@ static inline void spl_limit_it_seek(spl_dual_it_object *intern, long pos TSRMLS Construct a LimitIterator from an Iterator with a given starting offset and optionally a maximum count */ SPL_METHOD(LimitIterator, __construct) { - spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_iterator), DIT_LimitIterator); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_iterator, DIT_LimitIterator); } /* }}} */ /* {{{ proto void LimitIterator::rewind() @@ -1649,7 +1649,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern TSRMLS_DC) } else { INIT_PZVAL(&zflags); ZVAL_LONG(&zflags, intern->u.caching.flags & CIT_PUBLIC); - spl_instantiate_arg_ex2(U_CLASS_ENTRY(spl_ce_RecursiveCachingIterator), &intern->u.caching.zchildren, 1, zchildren, &zflags TSRMLS_CC); + spl_instantiate_arg_ex2(spl_ce_RecursiveCachingIterator, &intern->u.caching.zchildren, 1, zchildren, &zflags TSRMLS_CC); zval_ptr_dtor(&zchildren); } } @@ -1692,7 +1692,7 @@ static inline void spl_caching_it_rewind(spl_dual_it_object *intern TSRMLS_DC) Construct a CachingIterator from an Iterator */ SPL_METHOD(CachingIterator, __construct) { - spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_iterator), DIT_CachingIterator); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_iterator, DIT_CachingIterator); } /* }}} */ /* {{{ proto void CachingIterator::rewind() @@ -1748,7 +1748,7 @@ SPL_METHOD(CachingIterator, __toString) intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); if (!(intern->u.caching.flags & (CIT_CALL_TOSTRING|CIT_TOSTRING_USE_KEY|CIT_TOSTRING_USE_CURRENT))) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_BadMethodCallException), 0 TSRMLS_CC, "%v does not fetch string value (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); + zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%v does not fetch string value (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); } if (intern->u.caching.flags & CIT_TOSTRING_USE_KEY) { if (intern->current.key_type == HASH_KEY_IS_STRING) { @@ -1788,7 +1788,7 @@ SPL_METHOD(CachingIterator, offsetSet) intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); if (!(intern->u.caching.flags & CIT_FULL_CACHE)) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_BadMethodCallException), 0 TSRMLS_CC, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); + zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Tz", &arKey, &nKeyLength, &type, &value) == FAILURE) { @@ -1813,7 +1813,7 @@ SPL_METHOD(CachingIterator, offsetGet) intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); if (!(intern->u.caching.flags & CIT_FULL_CACHE)) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_BadMethodCallException), 0 TSRMLS_CC, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); + zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "T", &arKey, &nKeyLength, &type) == FAILURE) { @@ -1841,7 +1841,7 @@ SPL_METHOD(CachingIterator, offsetUnset) intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); if (!(intern->u.caching.flags & CIT_FULL_CACHE)) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_BadMethodCallException), 0 TSRMLS_CC, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); + zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "T", &arKey, &nKeyLength, &type) == FAILURE) { @@ -1864,7 +1864,7 @@ SPL_METHOD(CachingIterator, offsetExists) intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); if (!(intern->u.caching.flags & CIT_FULL_CACHE)) { - zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_BadMethodCallException), 0 TSRMLS_CC, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); + zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "T", &arKey, &nKeyLength, &type) == FAILURE) { @@ -1906,7 +1906,7 @@ SPL_METHOD(CachingIterator, setFlags) return; } if ((intern->u.caching.flags & CIT_CALL_TOSTRING) != 0 && (flags & ~CIT_CALL_TOSTRING) == 0) { - zend_throw_exception(U_CLASS_ENTRY(spl_ce_InvalidArgumentException), "Unsetting flag CALL_TO_STRING is not possible", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_InvalidArgumentException, "Unsetting flag CALL_TO_STRING is not possible", 0 TSRMLS_CC); return; } if ((flags && CIT_FULL_CACHE) != 0 && (intern->u.caching.flags & CIT_FULL_CACHE) == 0) { @@ -1962,7 +1962,7 @@ static zend_function_entry spl_funcs_CachingIterator[] = { Create an iterator from a RecursiveIterator */ SPL_METHOD(RecursiveCachingIterator, __construct) { - spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(spl_ce_RecursiveIterator), DIT_RecursiveCachingIterator); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_RecursiveIterator, DIT_RecursiveCachingIterator); } /* }}} */ /* {{{ proto bolean RecursiveCachingIterator::hasChildren() @@ -2008,7 +2008,7 @@ static zend_function_entry spl_funcs_RecursiveCachingIterator[] = { Create an iterator from anything that is traversable */ SPL_METHOD(IteratorIterator, __construct) { - spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_traversable), DIT_IteratorIterator); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_traversable, DIT_IteratorIterator); } /* }}} */ static @@ -2031,7 +2031,7 @@ static zend_function_entry spl_funcs_IteratorIterator[] = { Create an iterator from another iterator */ SPL_METHOD(NoRewindIterator, __construct) { - spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_iterator), DIT_NoRewindIterator); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_iterator, DIT_NoRewindIterator); } /* }}} */ /* {{{ proto void NoRewindIterator::rewind() @@ -2123,7 +2123,7 @@ static zend_function_entry spl_funcs_NoRewindIterator[] = { Create an iterator from another iterator */ SPL_METHOD(InfiniteIterator, __construct) { - spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_iterator), DIT_InfiniteIterator); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_iterator, DIT_InfiniteIterator); } /* }}} */ /* {{{ proto InfiniteIterator::next() @@ -2168,14 +2168,14 @@ SPL_METHOD(EmptyIterator, valid) Throws exception */ SPL_METHOD(EmptyIterator, key) { - zend_throw_exception(U_CLASS_ENTRY(spl_ce_BadMethodCallException), "Accessing the key of an EmptyIterator", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_BadMethodCallException, "Accessing the key of an EmptyIterator", 0 TSRMLS_CC); } /* }}} */ /* {{{ proto EmptyIterator::current() Throws exception */ SPL_METHOD(EmptyIterator, current) { - zend_throw_exception(U_CLASS_ENTRY(spl_ce_BadMethodCallException), "Accessing the value of an EmptyIterator", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_BadMethodCallException, "Accessing the value of an EmptyIterator", 0 TSRMLS_CC); } /* }}} */ /* {{{ proto EmptyIterator::next() @@ -2246,7 +2246,7 @@ void spl_append_it_next(spl_dual_it_object *intern TSRMLS_DC) /* {{{ */ Create an AppendIterator */ SPL_METHOD(AppendIterator, __construct) { - spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_iterator), DIT_AppendIterator); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_iterator, DIT_AppendIterator); } /* }}} */ /* {{{ proto void AppendIterator::append(Iterator it) @@ -2258,7 +2258,7 @@ SPL_METHOD(AppendIterator, append) intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &it, U_CLASS_ENTRY(zend_ce_iterator)) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &it, zend_ce_iterator) == FAILURE) { return; } spl_array_iterator_append(intern->u.append.zarrayit, it TSRMLS_CC); @@ -2362,7 +2362,7 @@ PHP_FUNCTION(iterator_to_array) ulong int_key; int key_type; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &obj, U_CLASS_ENTRY(zend_ce_traversable)) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &obj, zend_ce_traversable) == FAILURE) { RETURN_FALSE; } @@ -2408,7 +2408,7 @@ PHP_FUNCTION(iterator_count) zend_object_iterator *iter; long count = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &obj, U_CLASS_ENTRY(zend_ce_traversable)) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &obj, zend_ce_traversable) == FAILURE) { RETURN_FALSE; } diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c index 96e87a1535..9c1ba5e278 100644 --- a/ext/sqlite/sqlite.c +++ b/ext/sqlite/sqlite.c @@ -879,12 +879,12 @@ static zend_object_value sqlite_object_new_exception(zend_class_entry *class_typ static zend_class_entry *sqlite_get_ce_query(zval *object TSRMLS_DC) { - return U_CLASS_ENTRY(sqlite_ce_query); + return sqlite_ce_query; } static zend_class_entry *sqlite_get_ce_ub_query(zval *object TSRMLS_DC) { - return U_CLASS_ENTRY(sqlite_ce_ub_query); + return sqlite_ce_ub_query; } static zval * sqlite_instanciate(zend_class_entry *pce, zval *object TSRMLS_DC) @@ -1188,7 +1188,7 @@ static struct php_sqlite_db *php_sqlite_open(char *filename, int mode, char *per if (object) { /* if object is not an object then we're called from the factory() function */ if (Z_TYPE_P(object) != IS_OBJECT) { - sqlite_instanciate(U_CLASS_ENTRY(sqlite_ce_db), object TSRMLS_CC); + sqlite_instanciate(sqlite_ce_db, object TSRMLS_CC); } /* and now register the object */ SQLITE_REGISTER_OBJECT(db, object, db) @@ -1295,7 +1295,7 @@ PHP_FUNCTION(sqlite_open) zval *errmsg = NULL; zval *object = getThis(); - php_set_error_handling(object ? EH_THROW : EH_NORMAL, U_CLASS_ENTRY(sqlite_ce_exception) TSRMLS_CC); + php_set_error_handling(object ? EH_THROW : EH_NORMAL, sqlite_ce_exception TSRMLS_CC); if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz/", &filename, &filename_len, &mode, &errmsg)) { php_std_error_handling(); @@ -1350,7 +1350,7 @@ PHP_FUNCTION(sqlite_factory) int filename_len; zval *errmsg = NULL; - php_set_error_handling(EH_THROW, U_CLASS_ENTRY(sqlite_ce_exception) TSRMLS_CC); + php_set_error_handling(EH_THROW, sqlite_ce_exception TSRMLS_CC); if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz/", &filename, &filename_len, &mode, &errmsg)) { php_std_error_handling(); @@ -1577,9 +1577,9 @@ terminate: if (object) { sqlite_object *obj; if (buffered) { - sqlite_instanciate(U_CLASS_ENTRY(sqlite_ce_query), return_value TSRMLS_CC); + sqlite_instanciate(sqlite_ce_query, return_value TSRMLS_CC); } else { - sqlite_instanciate(U_CLASS_ENTRY(sqlite_ce_ub_query), return_value TSRMLS_CC); + sqlite_instanciate(sqlite_ce_ub_query, return_value TSRMLS_CC); } obj = (sqlite_object *) zend_object_store_get_object(return_value TSRMLS_CC); obj->type = is_result; @@ -2073,7 +2073,7 @@ PHP_FUNCTION(sqlite_fetch_object) zval *ctor_params = NULL; zend_uchar class_name_type; - php_set_error_handling(object ? EH_THROW : EH_NORMAL, U_CLASS_ENTRY(sqlite_ce_exception) TSRMLS_CC); + php_set_error_handling(object ? EH_THROW : EH_NORMAL, sqlite_ce_exception TSRMLS_CC); if (object) { if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|tzb", &class_name, &class_name_len, &class_name_type, &ctor_params, &decode_binary)) { php_std_error_handling(); @@ -2081,7 +2081,7 @@ PHP_FUNCTION(sqlite_fetch_object) } RES_FROM_OBJECT(res, object); if (!ZEND_NUM_ARGS()) { - ce = U_CLASS_ENTRY(zend_standard_class_def); + ce = zend_standard_class_def; } else { ce = zend_u_fetch_class(class_name_type, class_name, class_name_len, ZEND_FETCH_CLASS_AUTO TSRMLS_CC); } @@ -2092,14 +2092,14 @@ PHP_FUNCTION(sqlite_fetch_object) } ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result); if (ZEND_NUM_ARGS() < 2) { - ce = U_CLASS_ENTRY(zend_standard_class_def); + ce = zend_standard_class_def; } else { ce = zend_u_fetch_class(class_name_type, class_name, class_name_len, ZEND_FETCH_CLASS_AUTO TSRMLS_CC); } } if (!ce) { - zend_throw_exception_ex(U_CLASS_ENTRY(sqlite_ce_exception), 0 TSRMLS_CC, "Could not find class '%s'", class_name); + zend_throw_exception_ex(sqlite_ce_exception, 0 TSRMLS_CC, "Could not find class '%s'", class_name); php_std_error_handling(); return; } @@ -2142,7 +2142,7 @@ PHP_FUNCTION(sqlite_fetch_object) * single value is an array. Also we'd have to make that one * argument passed by reference. */ - zend_throw_exception(U_CLASS_ENTRY(sqlite_ce_exception), "Parameter ctor_params must be an array", 0 TSRMLS_CC); + zend_throw_exception(sqlite_ce_exception, "Parameter ctor_params must be an array", 0 TSRMLS_CC); return; } } else { @@ -2157,7 +2157,7 @@ PHP_FUNCTION(sqlite_fetch_object) fcc.object_pp = &return_value; if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) { - zend_throw_exception_ex(U_CLASS_ENTRY(sqlite_ce_exception), 0 TSRMLS_CC, "Could not execute %s::%v()", class_name, ce->constructor->common.function_name); + zend_throw_exception_ex(sqlite_ce_exception, 0 TSRMLS_CC, "Could not execute %s::%v()", class_name, ce->constructor->common.function_name); } else { if (retval_ptr) { zval_ptr_dtor(&retval_ptr); @@ -2167,7 +2167,7 @@ PHP_FUNCTION(sqlite_fetch_object) efree(fci.params); } } else if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) { - zend_throw_exception_ex(U_CLASS_ENTRY(sqlite_ce_exception), 0 TSRMLS_CC, "Class %s does not have a constructor, use NULL for parameter ctor_params or omit it", class_name); + zend_throw_exception_ex(sqlite_ce_exception, 0 TSRMLS_CC, "Class %s does not have a constructor, use NULL for parameter ctor_params or omit it", class_name); } } /* }}} */ @@ -2545,7 +2545,7 @@ static int sqlite_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */ * count = obj->u.res->nrows; return SUCCESS; } else { - zend_throw_exception(U_CLASS_ENTRY(sqlite_ce_exception), "Row count is not available for unbuffered queries", 0 TSRMLS_CC); + zend_throw_exception(sqlite_ce_exception, "Row count is not available for unbuffered queries", 0 TSRMLS_CC); return FAILURE; } } /* }}} */ diff --git a/ext/standard/array.c b/ext/standard/array.c index 314897a386..ee1980b717 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -316,7 +316,7 @@ PHP_FUNCTION(count) /* it the object implements Countable we call its count() method */ zval *retval; - if (Z_OBJ_HT_P(array)->get_class_entry && instanceof_function(Z_OBJCE_P(array), U_CLASS_ENTRY(spl_ce_Countable) TSRMLS_CC)) { + if (Z_OBJ_HT_P(array)->get_class_entry && instanceof_function(Z_OBJCE_P(array), spl_ce_Countable TSRMLS_CC)) { zend_call_method_with_0_params(&array, NULL, NULL, "count", &retval); RETVAL_LONG(Z_LVAL_P(retval)); zval_ptr_dtor(&retval); diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 3495de67e8..36ab84fdc3 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -201,7 +201,7 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject) php_set_default_dir(dirp->rsrc_id TSRMLS_CC); if (createobject) { - object_init_ex(return_value, U_CLASS_ENTRY(dir_class_entry_ptr)); + object_init_ex(return_value, dir_class_entry_ptr); add_property_rt_stringl(return_value, "path", dirname, dir_len, 1); add_property_resource(return_value, "handle", dirp->rsrc_id); php_stream_auto_cleanup(dirp); /* so we don't get warnings under debug */ diff --git a/ext/unicode/unicode_iterators.c b/ext/unicode/unicode_iterators.c index 47dc7f7e1d..5fee51fc05 100644 --- a/ext/unicode/unicode_iterators.c +++ b/ext/unicode/unicode_iterators.c @@ -539,7 +539,7 @@ PHP_METHOD(TextIterator, __construct) intern->flags = flags; } - if (Z_OBJCE_P(this_ptr) == U_CLASS_ENTRY(rev_text_iterator_ce)) { + if (Z_OBJCE_P(this_ptr) == rev_text_iterator_ce) { intern->flags |= ITER_REVERSE; } diff --git a/main/SAPI.c b/main/SAPI.c index facdbc0acc..fa59cf808c 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -75,6 +75,7 @@ SAPI_API sapi_module_struct sapi_module; SAPI_API void sapi_startup(sapi_module_struct *sf) { + sf->ini_entries = NULL; sapi_module = *sf; #ifdef ZTS diff --git a/main/SAPI.h b/main/SAPI.h index 4998f7857b..9abf29b0fc 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -258,6 +258,8 @@ struct _sapi_module_struct { void (*ini_defaults)(HashTable *configuration_hash); int phpinfo_as_text; + + char *ini_entries; }; diff --git a/main/php_ini.c b/main/php_ini.c index 05b3bba553..b52ce72ee1 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -524,6 +524,11 @@ int php_init_config(TSRMLS_D) zend_llist_destroy(&scanned_ini_list); } } + + if (sapi_module.ini_entries) { + zend_parse_ini_string(sapi_module.ini_entries, 1, php_config_ini_parser_cb, &extension_lists); + } + return SUCCESS; } /* }}} */ diff --git a/main/php_variables.c b/main/php_variables.c index f59be9d86b..5d0ffa56d1 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -581,6 +581,7 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) php_register_variable_safe(var, val, new_val_len, array_ptr TSRMLS_CC); } */ + efree(u_var); efree(u_val); } } else { @@ -696,15 +697,11 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) } /* auto-type */ ALLOC_ZVAL(tmp); - Z_TYPE_P(tmp) = IS_STRING; - Z_STRLEN_P(tmp) = strlen(ss); - Z_STRVAL_P(tmp) = estrndup(ss, Z_STRLEN_P(tmp)); + ZVAL_RT_STRING(tmp, ss, 1); INIT_PZVAL(tmp); count++; if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(zval *), NULL) == FAILURE) { - if (Z_TYPE_P(tmp) == IS_STRING) { - efree(Z_STRVAL_P(tmp)); - } + efree(Z_STRVAL_P(tmp)); } if (space) { *space = '+'; diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index d55c84c5fd..cbba5c873f 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -846,22 +846,6 @@ static void init_request_info(TSRMLS_D) } /* }}} */ -static void define_command_line_ini_entry(char *arg) -{ - char *name, *value; - - name = arg; - value = strchr(arg, '='); - if (value) { - *value = 0; - value++; - } else { - value = "1"; - } - zend_alter_ini_entry(name, strlen(name) + 1, value, strlen(value), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); -} - - static void php_register_command_line_global_vars(char **arg TSRMLS_DC) { char *var, *val; @@ -913,6 +897,7 @@ int main(int argc, char *argv[]) char *orig_optarg = php_optarg; char *script_file = NULL; zend_llist global_vars; + int ini_entries_len = 0; /* end of temporary locals */ #ifdef ZTS @@ -995,6 +980,23 @@ int main(int argc, char *argv[]) /* if we're started on command line, check to see if we are being started as an 'external' fastcgi server by accepting a bindpath parameter. */ + case 'd': { + /* define ini entries on command line */ + int len = strlen(php_optarg); + + if (strchr(php_optarg, '=')) { + cgi_sapi_module.ini_entries = realloc(cgi_sapi_module.ini_entries, ini_entries_len + len + sizeof("\n\0")); + memcpy(cgi_sapi_module.ini_entries + ini_entries_len, php_optarg, len); + memcpy(cgi_sapi_module.ini_entries + ini_entries_len + len, "\n\0", sizeof("\n\0")); + ini_entries_len += len + sizeof("\n\0") - 2; + } else { + cgi_sapi_module.ini_entries = realloc(cgi_sapi_module.ini_entries, ini_entries_len + len + sizeof("=1\n\0")); + memcpy(cgi_sapi_module.ini_entries + ini_entries_len, php_optarg, len); + memcpy(cgi_sapi_module.ini_entries + ini_entries_len + len, "=1\n\0", sizeof("=1\n\0")); + ini_entries_len += len + sizeof("=1\n\0") - 2; + } + break; + } case 'b': if (!fastcgi) { bindpath = strdup(php_optarg); @@ -1270,9 +1272,6 @@ consult the installation file that came with this distribution, or visit \n\ case 'C': /* don't chdir to the script directory */ SG(options) |= SAPI_OPTION_NO_CHDIR; break; - case 'd': /* define ini entries on command line */ - define_command_line_ini_entry(php_optarg); - break; case 'e': /* enable extended info output */ CG(extended_info) = 1; @@ -1586,6 +1585,9 @@ fastcgi_request_done: if (cgi_sapi_module.php_ini_path_override) { free(cgi_sapi_module.php_ini_path_override); } + if (cgi_sapi_module.ini_entries) { + free(cgi_sapi_module.ini_entries); + } } zend_catch { exit_status = 255; } zend_end_try(); @@ -1595,7 +1597,7 @@ fastcgi_request_done: sapi_shutdown(); #ifdef ZTS - /*tsrm_shutdown();*/ + tsrm_shutdown(); #endif #if defined(PHP_WIN32) && ZEND_DEBUG && 0 diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index dda36aa3c4..fa22d26ae7 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -106,6 +106,14 @@ #define PHP_MODE_REFLECTION_CLASS 9 #define PHP_MODE_REFLECTION_EXTENSION 10 +#define HARDCODED_INI \ + "html_errors=0\n" \ + "register_argc_argv=1\n" \ + "implicit_flush=1\n" \ + "output_buffering=0\n" \ + "max_execution_time=0\n" + + static char *php_optarg = NULL; static int php_optind = 1; #if (HAVE_LIBREADLINE || HAVE_LIBEDIT) && !defined(COMPILE_DL_READLINE) @@ -335,10 +343,6 @@ static int php_cli_startup(sapi_module_struct *sapi_module) zend_hash_update(configuration_hash, name, sizeof(name), tmp, sizeof(zval), (void**)&entry);\ Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry)) -/* hard coded ini settings must be set in main() */ -#define INI_HARDCODED(name,value)\ - zend_alter_ini_entry(name, sizeof(name), value, strlen(value), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); - static void sapi_cli_ini_defaults(HashTable *configuration_hash) { zval *tmp, *entry; @@ -442,29 +446,6 @@ static void php_cli_usage(char *argv0) } /* }}} */ -static void define_command_line_ini_entry(char *arg TSRMLS_DC) -{ - char *name, *value; - - name = arg; - value = strchr(arg, '='); - if (value) { - *value = 0; - value++; - } else { - value = "1"; - } - - if (!strcasecmp(name, "extension")) { /* load function module */ - zval extension, zval; - ZVAL_STRING(&extension, value, 0); - php_dl(&extension, MODULE_PERSISTENT, &zval, 1 TSRMLS_CC); - } else { - zend_alter_ini_entry(name, strlen(name)+1, value, strlen(value), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); - } -} - - static void php_register_command_line_global_vars(char **arg TSRMLS_DC) { char *var, *val; @@ -608,6 +589,7 @@ int main(int argc, char *argv[]) int argc = __argc; char **argv = __argv; #endif + int ini_entries_len = 0; #if defined(PHP_WIN32) && defined(_DEBUG) && defined(PHP_WIN32_DEBUG_HEAP) { @@ -651,15 +633,36 @@ int main(int argc, char *argv[]) setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */ #endif + ini_entries_len = strlen(HARDCODED_INI); + cli_sapi_module.ini_entries = malloc(ini_entries_len+2); + memcpy(cli_sapi_module.ini_entries, HARDCODED_INI, ini_entries_len+1); + cli_sapi_module.ini_entries[ini_entries_len+1] = 0; while ((c = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0))!=-1) { switch (c) { - case 'c': - cli_sapi_module.php_ini_path_override = strdup(php_optarg); - break; - case 'n': - cli_sapi_module.php_ini_ignore = 1; - break; + case 'c': + cli_sapi_module.php_ini_path_override = strdup(php_optarg); + break; + case 'n': + cli_sapi_module.php_ini_ignore = 1; + break; + case 'd': { + /* define ini entries on command line */ + int len = strlen(php_optarg); + + if (strchr(php_optarg, '=')) { + cli_sapi_module.ini_entries = realloc(cli_sapi_module.ini_entries, ini_entries_len + len + sizeof("\n\0")); + memcpy(cli_sapi_module.ini_entries + ini_entries_len, php_optarg, len); + memcpy(cli_sapi_module.ini_entries + ini_entries_len + len, "\n\0", sizeof("\n\0")); + ini_entries_len += len + sizeof("\n\0") - 2; + } else { + cli_sapi_module.ini_entries = realloc(cli_sapi_module.ini_entries, ini_entries_len + len + sizeof("=1\n\0")); + memcpy(cli_sapi_module.ini_entries + ini_entries_len, php_optarg, len); + memcpy(cli_sapi_module.ini_entries + ini_entries_len + len, "=1\n\0", sizeof("=1\n\0")); + ini_entries_len += len + sizeof("=1\n\0") - 2; + } + break; + } } } php_optind = orig_optind; @@ -690,7 +693,6 @@ int main(int argc, char *argv[]) zend_first_try { zend_llist_init(&global_vars, sizeof(char *), NULL, 0); - zend_uv.html_errors = 0; /* tell the engine we're in non-html mode */ CG(in_compilation) = 0; /* not initialized but needed for several options */ EG(uninitialized_zval_ptr) = NULL; @@ -700,20 +702,9 @@ int main(int argc, char *argv[]) goto out_err; } - /* here is the place for hard coded defaults which cannot be overwritten in the ini file */ - INI_HARDCODED("register_argc_argv", "1"); - INI_HARDCODED("html_errors", "0"); - INI_HARDCODED("implicit_flush", "1"); - INI_HARDCODED("output_buffering", "0"); - INI_HARDCODED("max_execution_time", "0"); - while ((c = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0)) != -1) { switch (c) { - case 'd': /* define ini entries on command line */ - define_command_line_ini_entry(php_optarg TSRMLS_CC); - break; - case 'h': /* help & quit */ case '?': if (php_request_startup(TSRMLS_C)==FAILURE) { @@ -1237,6 +1228,9 @@ int main(int argc, char *argv[]) if (cli_sapi_module.php_ini_path_override) { free(cli_sapi_module.php_ini_path_override); } + if (cli_sapi_module.ini_entries) { + free(cli_sapi_module.ini_entries); + } } zend_end_try(); out: @@ -1253,7 +1247,7 @@ out_err: tsrm_shutdown(); #endif - exit(exit_status); + return exit_status; err: zend_ini_deactivate(TSRMLS_C); diff --git a/tests/lang/bug25145.phpt b/tests/lang/bug25145.phpt index e33580ab0d..2f572df073 100755 --- a/tests/lang/bug25145.phpt +++ b/tests/lang/bug25145.phpt @@ -20,3 +20,13 @@ array(1) { } } Done +--UEXPECT-- +array(1) { + [123]=> + array(1) { + [0]=> + unicode(4) "SEGV" + } +} +Done + diff --git a/tests/run-test/test004.phpt b/tests/run-test/test004.phpt index 8bf1f7b252..4742ea36fd 100644 --- a/tests/run-test/test004.phpt +++ b/tests/run-test/test004.phpt @@ -1,7 +1,7 @@ --TEST-- INI section allows '=' --INI-- -arg_separator.input== +arg_separator.input="=" --FILE--