From 21c1109e0c426ed472500c58ac5236001a7277a5 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 12 Aug 2005 11:29:33 +0000 Subject: [PATCH] Unicode support --- Zend/zend.c | 118 ++++++++++++++++++++++--------- Zend/zend.h | 2 + Zend/zend_API.c | 18 +---- Zend/zend_API.h | 7 +- Zend/zend_compile.c | 2 +- Zend/zend_compile.h | 3 + Zend/zend_exceptions.c | 66 ++++++++---------- Zend/zend_exceptions.h | 2 - Zend/zend_interfaces.c | 16 ++--- Zend/zend_interfaces.h | 2 - Zend/zend_object_handlers.c | 30 ++++---- Zend/zend_operators.c | 2 +- Zend/zend_reflection_api.c | 120 ++++++++++++++------------------ Zend/zend_reflection_api.h | 2 - ext/dom/attr.c | 6 +- ext/dom/cdatasection.c | 4 +- ext/dom/characterdata.c | 10 +-- ext/dom/comment.c | 4 +- ext/dom/document.c | 54 +++++++------- ext/dom/documentfragment.c | 2 +- ext/dom/dom_iterators.c | 2 +- ext/dom/domexception.c | 2 +- ext/dom/domimplementation.c | 2 +- ext/dom/element.c | 34 ++++----- ext/dom/entityreference.c | 4 +- ext/dom/namednodemap.c | 6 +- ext/dom/node.c | 26 +++---- ext/dom/nodelist.c | 2 +- ext/dom/php_dom.c | 34 ++++----- ext/dom/processinginstruction.c | 4 +- ext/dom/text.c | 8 +-- ext/dom/xpath.c | 8 +-- ext/pdo/pdo.c | 2 +- ext/pdo/pdo_dbh.c | 8 +-- ext/pdo/pdo_stmt.c | 2 +- ext/reflection/php_reflection.c | 120 ++++++++++++++------------------ ext/reflection/php_reflection.h | 2 - ext/simplexml/simplexml.c | 8 +-- ext/spl/php_spl.c | 10 +-- ext/spl/spl_array.c | 14 ++-- ext/spl/spl_directory.c | 22 +++--- ext/spl/spl_iterators.c | 84 +++++++++++----------- 42 files changed, 433 insertions(+), 441 deletions(-) diff --git a/Zend/zend.c b/Zend/zend.c index e8dae36677..f2c2e3a15e 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -755,6 +755,27 @@ static void function_to_unicode(zend_function *func) u_charsToUChars(func->common.function_name, uname, len); func->common.function_name = (char*)uname; } + if (func->common.arg_info) { + zend_arg_info *args; + int n = func->common.num_args; + + args = malloc((n + 1) * sizeof(zend_arg_info)); + memcpy(args, func->common.arg_info, (n + 1) * sizeof(zend_arg_info)); + while (n > 0) { + --n; + if (args[n].name) { + UChar *uname = malloc(UBYTES(args[n].name_len)); + u_charsToUChars(args[n].name, uname, args[n].name_len); + args[n].name = (char*)uname; + } + if (args[n].class_name) { + UChar *uname = malloc(UBYTES(args[n].class_name_len)); + u_charsToUChars(args[n].class_name, uname, args[n].class_name_len); + args[n].class_name = (char*)uname; + } + } + func->common.arg_info = args; + } } static void property_info_to_unicode(zend_property_info *info) @@ -794,17 +815,41 @@ static void const_to_unicode(zend_constant *c) static void class_to_unicode(zend_class_entry **ce) { zend_class_entry *new_ce = malloc(sizeof(zend_class_entry)); - zend_function tmp_func; zend_constant tmp_const; 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_const, sizeof(zend_constant)); @@ -827,20 +872,14 @@ static void class_to_unicode(zend_class_entry **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; - zend_class_entry **parent; if (ce->parent) { - char *lcname = do_alloca(ce->parent->name_length+1); - - zend_str_tolower_copy(lcname, ce->parent->name, ce->parent->name_length); - if (zend_hash_find(ht, lcname, ce->parent->name_length+1, (void**)&parent) == SUCCESS) { - ce->parent = *parent; - } - free_alloca(lcname); + ce->parent = ce->parent->u_twin; } if (ce->num_interfaces > 0 && ce->interfaces) { int i = sizeof(zend_class_entry*)*ce->num_interfaces; @@ -850,30 +889,48 @@ static void fix_classes(HashTable *ht) { memcpy(new_interfaces, ce->interfaces, i); ce->interfaces = new_interfaces; for (i = 0; i < ce->num_interfaces; i++) { - char *lcname = do_alloca(ce->interfaces[i]->name_length+1); - - zend_str_tolower_copy(lcname, ce->interfaces[i]->name, ce->interfaces[i]->name_length); - if (zend_hash_find(ht, lcname, ce->interfaces[i]->name_length+1, (void**)&parent) == SUCCESS) { - ce->interfaces[i] = *parent; - } - free_alloca(lcname); - + ce->interfaces[i] = ce->interfaces[i]->u_twin; } } - p = p->pListNext; - } - - /* Convert Class Names to unicode */ - p = ht->pListHead; - while (p != NULL) { - zend_class_entry *ce = *(zend_class_entry**)p->pData; - UChar *uname = malloc(UBYTES(ce->name_length+1)); + + 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; + } - u_charsToUChars(ce->name, uname, ce->name_length+1); - ce->name = (char*)uname; + 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->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; + } p = p->pListNext; } + } #ifdef ZTS @@ -1435,14 +1492,9 @@ void zend_activate(TSRMLS_D) 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 - zend_standard_class_def = zend_get_named_class_entry("stdClass", sizeof("stdClass")-1 TSRMLS_CC); - init_unicode_request_globals(TSRMLS_C); init_unicode_strings(); - init_exceptions(TSRMLS_C); - init_interfaces(TSRMLS_C); - init_reflection_api(TSRMLS_C); init_compiler(TSRMLS_C); init_executor(TSRMLS_C); startup_scanner(TSRMLS_C); diff --git a/Zend/zend.h b/Zend/zend.h index b517ceff95..715a9e2578 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -381,6 +381,8 @@ struct _zend_class_entry { zend_uint line_end; char *doc_comment; zend_uint doc_comment_len; + + zend_class_entry *u_twin; struct _zend_module_entry *module; }; diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 49e2424a4a..faff14cbee 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -1068,7 +1068,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, zend_standard_class_def ZEND_FILE_LINE_RELAY_CC TSRMLS_CC); + return _object_init_ex(arg, U_CLASS_ENTRY(zend_standard_class_def) ZEND_FILE_LINE_RELAY_CC TSRMLS_CC); } @@ -2841,22 +2841,6 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *n return value; } -ZEND_API zend_class_entry* zend_get_named_class_entry(char* name, int name_length TSRMLS_DC) -{ - zend_class_entry **scope; - char *lcname = do_alloca(name_length+1); - - zend_str_tolower_copy(lcname, name, name_length); - if (zend_hash_find(CG(class_table), lcname, name_length+1, (void**)&scope) == FAILURE) { - free_alloca(lcname); - zend_error(E_ERROR, "Class '%s' is not defined", name); - return NULL; - } - free_alloca(lcname); - return *scope; -} - - /* * Return the most precise string type out of the list. * If none of the types are string types, IS_STRING is returned. diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 71473c150b..8442d38cf1 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -114,7 +114,7 @@ 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) @@ -135,6 +135,8 @@ typedef struct _zend_function_entry { class_container.__set = handle_propset; \ class_container.__unset = handle_propunset; \ class_container.__isset = handle_propisset; \ + class_container.serialize_func = NULL; \ + class_container.unserialize_func = NULL; \ class_container.serialize = NULL; \ class_container.unserialize = NULL; \ class_container.parent = NULL; \ @@ -142,6 +144,7 @@ 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; \ } @@ -385,8 +388,6 @@ ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length, ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC); ZEND_API int zend_u_delete_global_variable(zend_uchar type, void *name, int name_len TSRMLS_DC); -ZEND_API zend_class_entry* zend_get_named_class_entry(char* name, int name_length TSRMLS_DC); - ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC); #define add_method(arg, key, method) add_assoc_function((arg), (key), (method)) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 6bd87e5695..319bdb8e25 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -514,7 +514,7 @@ void zend_do_abstract_method(znode *function_name, znode *modifiers, znode *body if (modifiers->u.constant.value.lval & ZEND_ACC_ABSTRACT) { if(modifiers->u.constant.value.lval & ZEND_ACC_PRIVATE) { - zend_error(E_COMPILE_ERROR, "%s function %s::%s() cannot be declared private", method_type, CG(active_class_entry)->name, function_name->u.constant.value.str.val); + zend_error(E_COMPILE_ERROR, "%s function %v::%R() cannot be declared private", method_type, CG(active_class_entry)->name, Z_TYPE(function_name->u.constant), Z_UNIVAL(function_name->u.constant)); } if (body->u.constant.value.lval == ZEND_ACC_ABSTRACT) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 869a0a89ea..8ddffd3be3 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -179,6 +179,7 @@ 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; @@ -232,6 +233,7 @@ 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); @@ -253,6 +255,7 @@ 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 b19a460f3a..a28a96354f 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -94,9 +94,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 TSRMLS_CC); - zend_update_property_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); + zend_update_property_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); return obj.value.obj; } @@ -138,11 +138,11 @@ ZEND_METHOD(exception, __construct) object = getThis(); if (message) { - zend_update_property_string(default_exception_ce, object, "message", sizeof("message")-1, message TSRMLS_CC); + zend_update_property_string(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message TSRMLS_CC); } if (code) { - 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, "code", sizeof("code")-1, code TSRMLS_CC); } } /* }}} */ @@ -164,21 +164,21 @@ ZEND_METHOD(error_exception, __construct) object = getThis(); if (message) { - zend_update_property_string(default_exception_ce, object, "message", sizeof("message")-1, message TSRMLS_CC); + zend_update_property_string(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message TSRMLS_CC); } if (code) { - 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, "code", sizeof("code")-1, code TSRMLS_CC); } - zend_update_property_long(default_exception_ce, object, "severity", sizeof("severity")-1, severity TSRMLS_CC); + zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), object, "severity", sizeof("severity")-1, severity TSRMLS_CC); if (argc >= 4) { - zend_update_property_string(default_exception_ce, object, "file", sizeof("file")-1, filename TSRMLS_CC); + zend_update_property_string(U_CLASS_ENTRY(default_exception_ce), object, "file", sizeof("file")-1, filename TSRMLS_CC); if (argc < 5) { lineno = 0; /* invalidate lineno */ } - zend_update_property_long(default_exception_ce, object, "line", sizeof("line")-1, lineno TSRMLS_CC); + zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), object, "line", sizeof("line")-1, lineno TSRMLS_CC); } } /* }}} */ @@ -192,7 +192,7 @@ static void _default_exception_get_entry(zval *object, char *name, int name_len, { zval *value; - value = zend_read_property(default_exception_ce, object, name, name_len, 0 TSRMLS_CC); + value = zend_read_property(U_CLASS_ENTRY(default_exception_ce), object, name, name_len, 0 TSRMLS_CC); *return_value = *value; zval_copy_ctor(return_value); @@ -435,7 +435,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(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC); + trace = zend_read_property(U_CLASS_ENTRY(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); @@ -508,7 +508,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(default_exception_ce, getThis(), "string", sizeof("string")-1, str TSRMLS_CC); + zend_update_property_string(U_CLASS_ENTRY(default_exception_ce), getThis(), "string", sizeof("string")-1, str TSRMLS_CC); if (trace) { zval_ptr_dtor(&trace); @@ -590,12 +590,12 @@ void zend_register_default_exception(TSRMLS_D) ZEND_API zend_class_entry *zend_exception_get_default(void) { - return default_exception_ce; + return U_CLASS_ENTRY(default_exception_ce); } ZEND_API zend_class_entry *zend_get_error_exception(void) { - return error_exception_ce; + return U_CLASS_ENTRY(error_exception_ce); } @@ -605,21 +605,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, default_exception_ce TSRMLS_CC)) { + if (!instanceof_function(exception_ce, U_CLASS_ENTRY(default_exception_ce) TSRMLS_CC)) { zend_error(E_NOTICE, "Exceptions must be derived from the Exception base class"); - exception_ce = default_exception_ce; + exception_ce = U_CLASS_ENTRY(default_exception_ce); } } else { - exception_ce = default_exception_ce; + exception_ce = U_CLASS_ENTRY(default_exception_ce); } object_init_ex(ex, exception_ce); if (message) { - zend_update_property_string(default_exception_ce, ex, "message", sizeof("message")-1, message TSRMLS_CC); + zend_update_property_string(U_CLASS_ENTRY(default_exception_ce), ex, "message", sizeof("message")-1, message TSRMLS_CC); } if (code) { - zend_update_property_long(default_exception_ce, ex, "code", sizeof("code")-1, code TSRMLS_CC); + zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), ex, "code", sizeof("code")-1, code TSRMLS_CC); } zend_throw_exception_internal(ex TSRMLS_CC); @@ -645,7 +645,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(default_exception_ce, ex, "severity", sizeof("severity")-1, severity TSRMLS_CC); + zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), ex, "severity", sizeof("severity")-1, severity TSRMLS_CC); return ex; } @@ -662,7 +662,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, default_exception_ce TSRMLS_CC)) { + if (instanceof_function(ce_exception, U_CLASS_ENTRY(default_exception_ce) TSRMLS_CC)) { zval *str, *file, *line; EG(exception) = NULL; @@ -672,16 +672,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(default_exception_ce, exception, "string", sizeof("string")-1, EG(exception) ? ce_exception->name : Z_STRVAL_P(str) TSRMLS_CC); + 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); } } zval_ptr_dtor(&str); if (EG(exception)) { /* do the best we can to inform about the inner exception */ - 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); + 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); } else { file = NULL; line = NULL; @@ -689,9 +689,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(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); + 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); zend_error_va(E_ERROR, Z_STRVAL_P(file), Z_LVAL_P(line), "Uncaught %s\n thrown", Z_STRVAL_P(str)); } else { @@ -710,18 +710,12 @@ ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC) exception_ce = Z_OBJCE_P(exception); - if (!exception_ce || !instanceof_function(exception_ce, default_exception_ce TSRMLS_CC)) { + if (!exception_ce || !instanceof_function(exception_ce, U_CLASS_ENTRY(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); } -void init_exceptions(TSRMLS_D) -{ - default_exception_ce = zend_get_named_class_entry("Exception", sizeof("Exception")-1 TSRMLS_CC); - error_exception_ce = zend_get_named_class_entry("ErrorException", sizeof("ErrorException")-1 TSRMLS_CC); -} - /* * Local variables: * tab-width: 4 diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h index b546b08c24..0a47062265 100644 --- a/Zend/zend_exceptions.h +++ b/Zend/zend_exceptions.h @@ -48,8 +48,6 @@ extern ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC); /* show an exception using zend_error(E_ERROR,...) */ ZEND_API void zend_exception_error(zval *exception TSRMLS_DC); -void init_exceptions(TSRMLS_D); - END_EXTERN_C() #endif diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index c53a657c66..8a10f18ba9 100755 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -322,11 +322,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] == zend_ce_aggregate || class_type->interfaces[i] == zend_ce_iterator) { + if (class_type->interfaces[i] == U_CLASS_ENTRY(zend_ce_aggregate) || class_type->interfaces[i] == U_CLASS_ENTRY(zend_ce_iterator)) { return SUCCESS; } } - zend_error(E_CORE_ERROR, "Class %v must implement interface %v as part of either %v or %v", + zend_error(E_CORE_ERROR, "Class %v must implement interface %s as part of either %s or %s", class_type->name, zend_ce_traversable->name, zend_ce_iterator->name, @@ -348,10 +348,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] == zend_ce_iterator) { + if (class_type->interfaces[i] == U_CLASS_ENTRY(zend_ce_iterator)) { return FAILURE; } - if (class_type->interfaces[i] == zend_ce_traversable) { + if (class_type->interfaces[i] == U_CLASS_ENTRY(zend_ce_traversable)) { t = i; } } @@ -562,14 +562,6 @@ ZEND_API void zend_register_interfaces(TSRMLS_D) } /* }}} */ -void init_interfaces(TSRMLS_D) -{ - zend_ce_traversable = zend_get_named_class_entry("Traversable", sizeof("Traversable")-1 TSRMLS_CC); - zend_ce_aggregate = zend_get_named_class_entry("IteratorAggregate", sizeof("IteratorAggregate")-1 TSRMLS_CC); - zend_ce_iterator = zend_get_named_class_entry("Iterator", sizeof("Iterator")-1 TSRMLS_CC); - zend_ce_arrayaccess = zend_get_named_class_entry("ArrayAccess", sizeof("ArrayAccess")-1 TSRMLS_CC); -} - /* * Local variables: * tab-width: 4 diff --git a/Zend/zend_interfaces.h b/Zend/zend_interfaces.h index 0894e8ae17..f2ebdbac37 100755 --- a/Zend/zend_interfaces.h +++ b/Zend/zend_interfaces.h @@ -51,8 +51,6 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend ZEND_API void zend_register_interfaces(TSRMLS_D); -void init_interfaces(TSRMLS_D); - END_EXTERN_C() #endif /* ZEND_INTERFACES_H */ diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 795868f314..ff0d59a4b1 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -207,7 +207,7 @@ ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce */ } else { if (!silent && (property_info->flags & ZEND_ACC_STATIC)) { - zend_error(E_STRICT, "Accessing static property %s::$%s as non static", ce->name, Z_STRVAL_P(member)); + zend_error(E_STRICT, "Accessing static property %v::$%R as non static", ce->name, Z_TYPE_P(member), Z_UNIVAL_P(member)); } return property_info; } @@ -229,7 +229,7 @@ ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce if (silent) { return NULL; } - zend_error(E_ERROR, "Cannot access %s property %v::$%s", zend_visibility_string(property_info->flags), ce->name, Z_STRVAL_P(member)); + zend_error(E_ERROR, "Cannot access %s property %v::$%R", zend_visibility_string(property_info->flags), ce->name, Z_TYPE_P(member), Z_STRVAL_P(member)); } else { /* fall through, return property_info... */ } @@ -287,17 +287,17 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC) zobj = Z_OBJ_P(object); use_get = (zobj->ce->__get && !zobj->in_get); - if (member->type != IS_STRING) { + if (member->type != IS_STRING && member->type != IS_UNICODE) { ALLOC_ZVAL(tmp_member); *tmp_member = *member; INIT_PZVAL(tmp_member); zval_copy_ctor(tmp_member); - convert_to_string(tmp_member); + convert_to_text(tmp_member); member = tmp_member; } #if DEBUG_OBJECT_HANDLERS - fprintf(stderr, "Read object #%d property: %s\n", Z_OBJ_HANDLE_P(object), Z_STRVAL_P(member)); + fprintf(stderr, "Read object #%d property: %R\n", Z_OBJ_HANDLE_P(object), Z_TYPE_P(member), Z_STRVAL_P(member)); #endif /* make zend_get_property_info silent if we have getter - we may want to use it */ @@ -317,7 +317,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC) } } else { if (!silent) { - zend_error(E_NOTICE,"Undefined property: %v::$%s", zobj->ce->name, Z_STRVAL_P(member)); + zend_error(E_NOTICE,"Undefined property: %v::$%R", zobj->ce->name, Z_TYPE_P(member), Z_STRVAL_P(member)); } retval = &EG(uninitialized_zval_ptr); } @@ -403,7 +403,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, zend_ce_arrayaccess, 1 TSRMLS_CC)) { + if (instanceof_function_ex(ce, U_CLASS_ENTRY(zend_ce_arrayaccess), 1 TSRMLS_CC)) { if(offset == NULL) { /* [] construct */ ALLOC_INIT_ZVAL(offset); @@ -436,7 +436,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, zend_ce_arrayaccess, 1 TSRMLS_CC)) { + if (instanceof_function_ex(ce, U_CLASS_ENTRY(zend_ce_arrayaccess), 1 TSRMLS_CC)) { if (!offset) { ALLOC_INIT_ZVAL(offset); } else { @@ -456,7 +456,7 @@ static int zend_std_has_dimension(zval *object, zval *offset, int check_empty TS zval *retval; int result; - if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC)) { + if (instanceof_function_ex(ce, U_CLASS_ENTRY(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) { @@ -498,7 +498,7 @@ static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC } #if DEBUG_OBJECT_HANDLERS - fprintf(stderr, "Ptr object #%d property: %s\n", Z_OBJ_HANDLE_P(object), Z_STRVAL_P(member)); + fprintf(stderr, "Ptr object #%d property: %R\n", Z_OBJ_HANDLE_P(object), Z_TYPE_P(member), Z_STRVAL_P(member)); #endif property_info = zend_get_property_info(zobj->ce, member, 0 TSRMLS_CC); @@ -510,7 +510,7 @@ static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC /* we don't have access controls - will just add it */ new_zval = &EG(uninitialized_zval); -/* zend_error(E_NOTICE, "Undefined property: %s", Z_STRVAL_P(member)); */ +/* zend_error(E_NOTICE, "Undefined property: %R", Z_TYPE_P(member), Z_STRVAL_P(member)); */ new_zval->refcount++; zend_u_hash_quick_update(zobj->properties, Z_TYPE_P(member), property_info->name, property_info->name_length+1, property_info->h, &new_zval, sizeof(zval *), (void **) &retval); } else { @@ -565,7 +565,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, zend_ce_arrayaccess, 1 TSRMLS_CC)) { + if (instanceof_function_ex(ce, U_CLASS_ENTRY(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); @@ -757,14 +757,14 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, char *method */ updated_fbc = zend_check_private_int(fbc, object->value.obj.handlers->get_class_entry(object TSRMLS_CC), lc_method_name, method_len TSRMLS_CC); if (!updated_fbc) { - zend_error(E_ERROR, "Call to %s method %v::%v() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : ""); + zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : EMPTY_STR); } fbc = updated_fbc; } else if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) { /* Ensure that if we're calling a protected function, we're allowed to do so. */ if (!zend_check_protected(fbc->common.scope, EG(scope))) { - zend_error(E_ERROR, "Call to %s method %v::%v() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : ""); + zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : EMPTY_STR); } } @@ -926,7 +926,7 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists } #if DEBUG_OBJECT_HANDLERS - fprintf(stderr, "Read object #%d property: %s\n", Z_OBJ_HANDLE_P(object), Z_STRVAL_P(member)); + fprintf(stderr, "Read object #%d property: %R\n", Z_OBJ_HANDLE_P(object), Z_TYPE_P(member), Z_STRVAL_P(member)); #endif property_info = zend_get_property_info(zobj->ce, member, 1 TSRMLS_CC); diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index bb09fb3bb9..fc032d4c32 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -879,7 +879,7 @@ ZEND_API void convert_to_object(zval *op) switch (op->type) { case IS_ARRAY: { - object_and_properties_init(op, zend_standard_class_def, op->value.ht); + object_and_properties_init(op, U_CLASS_ENTRY(zend_standard_class_def), op->value.ht); return; break; } diff --git a/Zend/zend_reflection_api.c b/Zend/zend_reflection_api.c index fa001dc9b9..9677a37f68 100644 --- a/Zend/zend_reflection_api.c +++ b/Zend/zend_reflection_api.c @@ -54,11 +54,11 @@ zend_class_entry *reflection_extension_ptr; /* Exception throwing macro */ #define _DO_THROW(msg) \ - zend_throw_exception(reflection_exception_ptr, msg, 0 TSRMLS_CC); \ + zend_throw_exception(U_CLASS_ENTRY(reflection_exception_ptr), msg, 0 TSRMLS_CC); \ return; \ #define RETURN_ON_EXCEPTION \ - if (EG(exception) && Z_OBJCE_P(EG(exception)) == reflection_exception_ptr) { \ + if (EG(exception) && Z_OBJCE_P(EG(exception)) == U_CLASS_ENTRY(reflection_exception_ptr)) { \ return; \ } @@ -870,7 +870,7 @@ ZEND_API void zend_reflection_class_factory(zend_class_entry *ce, zval *object T } else { ZVAL_STRINGL(name, ce->name, ce->name_length, 1); } - reflection_instanciate(reflection_class_ptr, object TSRMLS_CC); + reflection_instanciate(U_CLASS_ENTRY(reflection_class_ptr), object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); intern->ptr = ce; intern->free_ptr = 0; @@ -896,7 +896,7 @@ static void reflection_extension_factory(zval *object, char *name_str TSRMLS_DC) } free_alloca(lcname); - reflection_instanciate(reflection_extension_ptr, object TSRMLS_CC); + reflection_instanciate(U_CLASS_ENTRY(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); @@ -924,7 +924,7 @@ static void reflection_parameter_factory(zend_function *fptr, struct _zend_arg_i } else { ZVAL_NULL(name); } - reflection_instanciate(reflection_parameter_ptr, object TSRMLS_CC); + reflection_instanciate(U_CLASS_ENTRY(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; @@ -951,7 +951,7 @@ static void reflection_function_factory(zend_function *function, zval *object TS ZVAL_STRING(name, function->common.function_name, 1); } - reflection_instanciate(reflection_function_ptr, object TSRMLS_CC); + reflection_instanciate(U_CLASS_ENTRY(reflection_function_ptr), object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); intern->ptr = function; intern->free_ptr = 0; @@ -976,7 +976,7 @@ static void reflection_method_factory(zend_class_entry *ce, zend_function *metho ZVAL_STRING(name, method->common.function_name, 1); ZVAL_STRINGL(classname, ce->name, ce->name_length, 1); } - reflection_instanciate(reflection_method_ptr, object TSRMLS_CC); + reflection_instanciate(U_CLASS_ENTRY(reflection_method_ptr), object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); intern->ptr = method; intern->free_ptr = 0; @@ -1023,7 +1023,7 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info ZVAL_STRINGL(classname, ce->name, ce->name_length, 1); } - reflection_instanciate(reflection_property_ptr, object TSRMLS_CC); + reflection_instanciate(U_CLASS_ENTRY(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; @@ -1107,7 +1107,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 = &reflection_ptr->function_table; + fci.function_table = &U_CLASS_ENTRY(reflection_ptr)->function_table; fci.function_name = &fname; fci.object_pp = NULL; fci.retval_ptr_ptr = &retval_ptr; @@ -1150,7 +1150,7 @@ ZEND_METHOD(reflection, export) int result; zend_bool return_output = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &object, reflector_ptr, &return_output) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &object, U_CLASS_ENTRY(reflector_ptr), &return_output) == FAILURE) { return; } @@ -1222,7 +1222,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, reflection_function_ptr, 1); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_function_ptr), 1); } /* }}} */ @@ -1252,7 +1252,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Function %R() does not exist", type, name_str); return; } @@ -1446,7 +1446,7 @@ ZEND_METHOD(reflection_function, invoke) efree(params); if (result == FAILURE) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Invocation of function %v() failed", fptr->common.function_name); return; } @@ -1510,7 +1510,7 @@ ZEND_METHOD(reflection_function, invokeArgs) efree(params); if (result == FAILURE) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Invocation of function %v() failed", fptr->common.function_name); return; } @@ -1594,7 +1594,7 @@ ZEND_METHOD(reflection_function, getParameters) 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, reflection_parameter_ptr, 2); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_parameter_ptr), 2); } /* }}} */ @@ -1633,7 +1633,7 @@ ZEND_METHOD(reflection_parameter, __construct) lcname = zend_u_str_case_fold(Z_TYPE_P(reference), Z_STRVAL_P(reference), Z_STRLEN_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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Function %R() does not exist", Z_TYPE_P(reference), Z_STRVAL_P(reference)); return; } @@ -1659,7 +1659,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Class %R does not exist", Z_TYPE_PP(classref), Z_UNIVAL_PP(classref)); return; } @@ -1670,7 +1670,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(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; } @@ -1775,7 +1775,7 @@ ZEND_METHOD(reflection_parameter, getClass) if (zend_u_hash_find(EG(class_table), UG(unicode)?IS_UNICODE:IS_STRING, lcname, lcname_len + 1, (void **) &pce) == FAILURE) { efree(lcname); - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Class %v does not exist", param->arg_info->class_name); return; } @@ -1881,16 +1881,16 @@ ZEND_METHOD(reflection_parameter, getDefaultValue) if (param->fptr->type != ZEND_USER_FUNCTION) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot determine default value for internal functions"); + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Cannot determine default value for internal functions"); return; } if (param->offset < param->required) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter is not optional"); + zend_throw_exception_ex(U_CLASS_ENTRY(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(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error"); + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Internal error"); return; } @@ -1905,7 +1905,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, reflection_method_ptr, 2); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_method_ptr), 2); } /* }}} */ @@ -1940,7 +1940,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Class %v does not exist", Z_UNIVAL_P(classname)); return; } @@ -1968,7 +1968,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Method %v::%R() does not exist", ce->name, type, name_str); return; } @@ -2030,11 +2030,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(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, @@ -2095,7 +2095,7 @@ ZEND_METHOD(reflection_method, invoke) efree(params); if (result == FAILURE) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Invocation of method %v::%v() failed", mptr->common.scope->name, mptr->common.function_name); return; } @@ -2133,11 +2133,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(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, @@ -2164,7 +2164,7 @@ ZEND_METHOD(reflection_method, invokeArgs) } else { if (!object) { efree(params); - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(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; @@ -2199,7 +2199,7 @@ ZEND_METHOD(reflection_method, invokeArgs) efree(params); if (result == FAILURE) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Invocation of method %v::%v() failed", mptr->common.scope->name, mptr->common.function_name); return; } @@ -2319,7 +2319,7 @@ ZEND_METHOD(reflection_method, getDeclaringClass) 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, reflection_class_ptr, 1); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_class_ptr), 1); } /* }}} */ @@ -2365,7 +2365,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(reflection_exception_ptr, -1 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(argument)); + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), -1 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(argument)); } return; } @@ -2432,7 +2432,7 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue) if (def_value) { RETURN_ZVAL(def_value, 1, 0); } else { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Class %s does not have a property named %s", ce->name, name); } return; @@ -2463,7 +2463,7 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue) zend_update_class_constants(ce TSRMLS_CC); variable_ptr = zend_std_get_static_property(ce, name, name_len, 1 TSRMLS_CC); if (!variable_ptr) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Class %s does not have a property named %s", ce->name, name); return; } @@ -2709,7 +2709,7 @@ ZEND_METHOD(reflection_class, getMethod) efree(lc_name); } else { efree(lc_name); - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Method %R does not exist", type, name); return; } @@ -2813,7 +2813,7 @@ ZEND_METHOD(reflection_class, getProperty) if (zend_hash_find(&ce->properties_info, name, name_len + 1, (void**) &property_info) == SUCCESS && (property_info->flags & ZEND_ACC_SHADOW) == 0) { reflection_property_factory(ce, property_info, return_value TSRMLS_CC); } else { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Property %s does not exist", name); return; } @@ -3043,7 +3043,7 @@ ZEND_METHOD(reflection_class, newInstance) zend_fcall_info_cache fcc; if (!(ce->constructor->common.fn_flags & ZEND_ACC_PUBLIC)) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Access to non-public constructor of class %v", ce->name); + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Access to non-public constructor of class %v", ce->name); return; } @@ -3145,14 +3145,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Interface %s does not exist", Z_STRVAL_P(class_name)); return; } class_ce = *pce; break; case IS_OBJECT: - if (instanceof_function(Z_OBJCE_P(class_name), reflection_class_ptr TSRMLS_CC)) { + if (instanceof_function(Z_OBJCE_P(class_name), U_CLASS_ENTRY(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"); @@ -3163,7 +3163,7 @@ ZEND_METHOD(reflection_class, isSubclassOf) } /* no break */ default: - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Parameter one must either be a string or a ReflectionClass object"); return; } @@ -3192,14 +3192,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Interface %s does not exist", Z_STRVAL_P(interface)); return; } interface_ce = *pce; break; case IS_OBJECT: - if (instanceof_function(Z_OBJCE_P(interface), reflection_class_ptr TSRMLS_CC)) { + if (instanceof_function(Z_OBJCE_P(interface), U_CLASS_ENTRY(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"); @@ -3210,13 +3210,13 @@ ZEND_METHOD(reflection_class, implementsInterface) } /* no break */ default: - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Interface %v is a Class", interface_ce->name); return; } @@ -3276,7 +3276,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, reflection_object_ptr, 1); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_object_ptr), 1); } /* }}} */ @@ -3292,7 +3292,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, reflection_property_ptr, 2); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_property_ptr), 2); } /* }}} */ @@ -3325,7 +3325,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(classname)); return; } @@ -3342,7 +3342,7 @@ ZEND_METHOD(reflection_property, __construct) } if (zend_hash_find(&ce->properties_info, name_str, name_len + 1, (void **) &property_info) == FAILURE || (property_info->flags & ZEND_ACC_SHADOW)) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Property %v::$%s does not exist", ce->name, name_str); return; } @@ -3614,7 +3614,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, reflection_extension_ptr, 1); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_extension_ptr), 1); } /* }}} */ @@ -3643,7 +3643,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Extension %s does not exist", name_str); return; } @@ -4015,7 +4015,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(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 @@ -4106,20 +4106,6 @@ ZEND_API void zend_register_reflection_api(TSRMLS_D) { } /* }}} */ -void init_reflection_api(TSRMLS_D) -{ - reflection_exception_ptr = zend_get_named_class_entry("ReflectionException", sizeof("ReflectionException")-1 TSRMLS_CC); - reflection_ptr = zend_get_named_class_entry("Reflection", sizeof("Reflection")-1 TSRMLS_CC); - reflector_ptr = zend_get_named_class_entry("Reflector", sizeof("Reflector")-1 TSRMLS_CC); - reflection_function_ptr = zend_get_named_class_entry("ReflectionFunction", sizeof("ReflectionFunction")-1 TSRMLS_CC); - reflection_parameter_ptr = zend_get_named_class_entry("ReflectionParameter", sizeof("ReflectionParameter")-1 TSRMLS_CC); - reflection_method_ptr = zend_get_named_class_entry("ReflectionMethod", sizeof("ReflectionMethod")-1 TSRMLS_CC); - reflection_class_ptr = zend_get_named_class_entry("ReflectionClass", sizeof("ReflectionClass")-1 TSRMLS_CC); - reflection_object_ptr = zend_get_named_class_entry("ReflectionObject", sizeof("ReflectionObject")-1 TSRMLS_CC); - reflection_property_ptr = zend_get_named_class_entry("ReflectionProperty", sizeof("ReflectionProperty")-1 TSRMLS_CC); - reflection_extension_ptr = zend_get_named_class_entry("ReflectionExtension", sizeof("ReflectionExtension")-1 TSRMLS_CC); -} - /* * Local variables: * tab-width: 4 diff --git a/Zend/zend_reflection_api.h b/Zend/zend_reflection_api.h index a16ed9b7f9..fb06af4687 100644 --- a/Zend/zend_reflection_api.h +++ b/Zend/zend_reflection_api.h @@ -26,8 +26,6 @@ BEGIN_EXTERN_C() ZEND_API void zend_register_reflection_api(TSRMLS_D); ZEND_API void zend_reflection_class_factory(zend_class_entry *ce, zval *object TSRMLS_DC); -void init_reflection_api(TSRMLS_D); - END_EXTERN_C() #endif diff --git a/ext/dom/attr.c b/ext/dom/attr.c index 0cb44b32b4..bf5d1b594e 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, 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_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_std_error_handling(); return; } @@ -264,7 +264,7 @@ PHP_FUNCTION(dom_attr_is_id) xmlAttrPtr attrp; xmlNodePtr nodep; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_attr_class_entry) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_attr_class_entry)) == FAILURE) { return; } diff --git a/ext/dom/cdatasection.c b/ext/dom/cdatasection.c index b4d54365fe..d1fd90d84c 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, 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_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_std_error_handling(); return; } diff --git a/ext/dom/characterdata.c b/ext/dom/characterdata.c index 982b89cff7..87a9cb8b1a 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, dom_characterdata_class_entry, &offset, &count) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &id, U_CLASS_ENTRY(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, dom_characterdata_class_entry, &arg, &arg_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(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, dom_characterdata_class_entry, &offset, &arg, &arg_len) == FAILURE) { + 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) { 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, dom_characterdata_class_entry, &offset, &count) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &id, U_CLASS_ENTRY(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, dom_characterdata_class_entry, &offset, &count, &arg, &arg_len) == FAILURE) { + 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) { return; } diff --git a/ext/dom/comment.c b/ext/dom/comment.c index 075c466c1b..18f5b00599 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, 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_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_std_error_handling(); return; } diff --git a/ext/dom/document.c b/ext/dom/document.c index 920d89edfb..a76ba5e0fc 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -773,7 +773,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, 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, U_CLASS_ENTRY(dom_document_class_entry), &name, &name_len, &value, &value_len) == FAILURE) { return; } @@ -806,7 +806,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, dom_document_class_entry) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_document_class_entry)) == FAILURE) { return; } @@ -835,7 +835,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, dom_document_class_entry, &value, &value_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &value, &value_len) == FAILURE) { return; } @@ -864,7 +864,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, dom_document_class_entry, &value, &value_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &value, &value_len) == FAILURE) { return; } @@ -893,7 +893,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, dom_document_class_entry, &value, &value_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &value, &value_len) == FAILURE) { return; } @@ -922,7 +922,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, 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, U_CLASS_ENTRY(dom_document_class_entry), &name, &name_len, &value, &value_len) == FAILURE) { return; } @@ -958,7 +958,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, dom_document_class_entry, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &name, &name_len) == FAILURE) { return; } @@ -993,7 +993,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, dom_document_class_entry, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &name, &name_len) == FAILURE) { return; } @@ -1027,7 +1027,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, dom_document_class_entry, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &name, &name_len) == FAILURE) { return; } @@ -1055,7 +1055,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, dom_document_class_entry, &node, dom_node_class_entry, &recursive) == FAILURE) { + 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) { return; } @@ -1100,7 +1100,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, 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, U_CLASS_ENTRY(dom_document_class_entry), &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) { return; } @@ -1164,7 +1164,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, 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, U_CLASS_ENTRY(dom_document_class_entry), &uri, &uri_len, &name, &name_len) == FAILURE) { return; } @@ -1227,7 +1227,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, dom_document_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) { + 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) { return; } @@ -1255,7 +1255,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, dom_document_class_entry, &idname, &idname_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &idname, &idname_len) == FAILURE) { return; } @@ -1294,7 +1294,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, dom_document_class_entry) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_document_class_entry)) == FAILURE) { return; } @@ -1325,8 +1325,8 @@ PHP_METHOD(domdocument, __construct) char *encoding, *version = NULL; int encoding_len = 0, version_len = 0, refcount; - 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_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_std_error_handling(); return; } @@ -1552,7 +1552,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), dom_document_class_entry TSRMLS_CC)) { + if (id != NULL && ! instanceof_function(Z_OBJCE_P(id), U_CLASS_ENTRY(dom_document_class_entry) TSRMLS_CC)) { id = NULL; } @@ -1630,7 +1630,7 @@ PHP_FUNCTION(dom_document_save) dom_doc_props *doc_props; char *file; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &file, &file_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &file, &file_len) == FAILURE) { return; } @@ -1669,7 +1669,7 @@ PHP_FUNCTION(dom_document_savexml) dom_doc_props *doc_props; int size, format; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|O", &id, dom_document_class_entry, &nodep, dom_node_class_entry) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|O", &id, U_CLASS_ENTRY(dom_document_class_entry), &nodep, U_CLASS_ENTRY(dom_node_class_entry)) == FAILURE) { return; } @@ -1755,7 +1755,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, dom_document_class_entry, &flags) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &id, U_CLASS_ENTRY(dom_document_class_entry), &flags) == FAILURE) { return; } @@ -1798,7 +1798,7 @@ PHP_FUNCTION(dom_document_validate) dom_object *intern; xmlValidCtxt *cvp; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_document_class_entry) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_document_class_entry)) == FAILURE) { return; } @@ -1840,7 +1840,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, dom_document_class_entry, &source, &source_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &source, &source_len) == FAILURE) { return; } @@ -1930,7 +1930,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, dom_document_class_entry, &source, &source_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &source, &source_len) == FAILURE) { return; } @@ -2054,7 +2054,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) if (!newdoc) RETURN_FALSE; - if (id != NULL && instanceof_function(Z_OBJCE_P(id), dom_document_class_entry TSRMLS_CC)) { + if (id != NULL && instanceof_function(Z_OBJCE_P(id), U_CLASS_ENTRY(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); @@ -2111,7 +2111,7 @@ PHP_FUNCTION(dom_document_save_html_file) dom_doc_props *doc_props; char *file; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &file, &file_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &file, &file_len) == FAILURE) { return; } @@ -2146,7 +2146,7 @@ PHP_FUNCTION(dom_document_save_html) xmlChar *mem; int size; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_document_class_entry) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_document_class_entry)) == FAILURE) { return; } diff --git a/ext/dom/documentfragment.c b/ext/dom/documentfragment.c index 27493a7ad0..5e8dabe461 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, dom_domexception_class_entry TSRMLS_CC); + 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", &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 ded333bf36..378abc405e 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), dom_nodelist_class_entry TSRMLS_CC)) { + if (instanceof_function(Z_OBJCE_P(object), U_CLASS_ENTRY(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 d06b3b5889..2db21db5e9 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(dom_domexception_class_entry, error_message, error_code TSRMLS_CC); + zend_throw_exception(U_CLASS_ENTRY(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 0116e7d20e..0f271877c6 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, dom_documenttype_class_entry) == FAILURE) { + 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) { return; } diff --git a/ext/dom/element.c b/ext/dom/element.c index 0dfc7d73af..26fb297488 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, 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_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_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, dom_element_class_entry, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(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, dom_element_class_entry, &name, &name_len, &value, &value_len) == FAILURE) { + 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) { 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, dom_element_class_entry, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(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, dom_element_class_entry, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(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, dom_element_class_entry, &node, dom_attr_class_entry) == FAILURE) { + 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) { return; } @@ -408,7 +408,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, dom_element_class_entry, &node, dom_attr_class_entry) == FAILURE) { + 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) { return; } @@ -447,7 +447,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, dom_element_class_entry, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_element_class_entry), &name, &name_len) == FAILURE) { return; } @@ -474,7 +474,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, 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, U_CLASS_ENTRY(dom_element_class_entry), &uri, &uri_len, &name, &name_len) == FAILURE) { return; } @@ -518,7 +518,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, 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, U_CLASS_ENTRY(dom_element_class_entry), &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) { return; } @@ -614,7 +614,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, 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, U_CLASS_ENTRY(dom_element_class_entry), &uri, &uri_len, &name, &name_len) == FAILURE) { return; } @@ -671,7 +671,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, 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, U_CLASS_ENTRY(dom_element_class_entry), &uri, &uri_len, &name, &name_len) == FAILURE) { return; } @@ -702,7 +702,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, dom_element_class_entry, &node, dom_attr_class_entry) == FAILURE) { + 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) { return; } @@ -768,7 +768,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, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) { + 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) { return; } @@ -796,7 +796,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, dom_element_class_entry, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_element_class_entry), &name, &name_len) == FAILURE) { return; } @@ -826,7 +826,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, 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, U_CLASS_ENTRY(dom_element_class_entry), &uri, &uri_len, &name, &name_len) == FAILURE) { return; } diff --git a/ext/dom/entityreference.c b/ext/dom/entityreference.c index af48116210..8bea784261 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, 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_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_std_error_handling(); return; } diff --git a/ext/dom/namednodemap.c b/ext/dom/namednodemap.c index 7f7a114c74..b14b526ba3 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, dom_namednodemap_class_entry, &named, &namedlen) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(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, dom_namednodemap_class_entry, &index) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, U_CLASS_ENTRY(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, dom_namednodemap_class_entry, &uri, &urilen, &named, &namedlen) == FAILURE) { + 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) { return; } diff --git a/ext/dom/node.c b/ext/dom/node.c index cd9523905c..2ff6ebcee6 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, dom_node_class_entry, &node, dom_node_class_entry, &ref, dom_node_class_entry) == FAILURE) { + 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) { 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, dom_node_class_entry, &newnode, dom_node_class_entry, &oldnode, dom_node_class_entry) == FAILURE) { + 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) { 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, dom_node_class_entry, &node, dom_node_class_entry) == FAILURE) { + 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) { 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, dom_node_class_entry, &node, dom_node_class_entry) == FAILURE) { + 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) { 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, dom_node_class_entry) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(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, dom_node_class_entry, &recursive) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &id, U_CLASS_ENTRY(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, dom_node_class_entry) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(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, dom_node_class_entry, &feature, &feature_len, &version, &version_len) == FAILURE) { + 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) { 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, dom_node_class_entry) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(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, dom_node_class_entry, &node, dom_node_class_entry) == FAILURE) { + 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) { 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, dom_node_class_entry, &uri, &uri_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(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, dom_node_class_entry, &uri, &uri_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(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, dom_node_class_entry, &prefix, &prefix_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_node_class_entry), &prefix, &prefix_len) == FAILURE) { return; } diff --git a/ext/dom/nodelist.c b/ext/dom/nodelist.c index 52f6b0a44b..db4798b4bd 100644 --- a/ext/dom/nodelist.c +++ b/ext/dom/nodelist.c @@ -111,7 +111,7 @@ PHP_FUNCTION(dom_nodelist_item) HashTable *nodeht; pval **entry; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, dom_nodelist_class_entry, &index) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, U_CLASS_ENTRY(dom_nodelist_class_entry), &index) == FAILURE) { return; } diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index b7fc1724cc..c5c6343085 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -973,7 +973,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, dom_node_class_entry TSRMLS_CC)) { + if (instanceof_function(intern->std.ce, U_CLASS_ENTRY(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); @@ -1094,9 +1094,9 @@ void php_dom_create_interator(zval *return_value, int ce_type TSRMLS_DC) zend_class_entry *ce; if (ce_type == DOM_NAMEDNODEMAP) { - ce = dom_namednodemap_class_entry; + ce = U_CLASS_ENTRY(dom_namednodemap_class_entry); } else { - ce = dom_nodelist_class_entry; + ce = U_CLASS_ENTRY(dom_nodelist_class_entry); } object_init_ex(return_value, ce); @@ -1133,69 +1133,69 @@ zval *php_dom_create_object(xmlNodePtr obj, int *found, zval *wrapper_in, zval * case XML_DOCUMENT_NODE: case XML_HTML_DOCUMENT_NODE: { - ce = dom_document_class_entry; + ce = U_CLASS_ENTRY(dom_document_class_entry); break; } case XML_DTD_NODE: case XML_DOCUMENT_TYPE_NODE: { - ce = dom_documenttype_class_entry; + ce = U_CLASS_ENTRY(dom_documenttype_class_entry); break; } case XML_ELEMENT_NODE: { - ce = dom_element_class_entry; + ce = U_CLASS_ENTRY(dom_element_class_entry); break; } case XML_ATTRIBUTE_NODE: { - ce = dom_attr_class_entry; + ce = U_CLASS_ENTRY(dom_attr_class_entry); break; } case XML_TEXT_NODE: { - ce = dom_text_class_entry; + ce = U_CLASS_ENTRY(dom_text_class_entry); break; } case XML_COMMENT_NODE: { - ce = dom_comment_class_entry; + ce = U_CLASS_ENTRY(dom_comment_class_entry); break; } case XML_PI_NODE: { - ce = dom_processinginstruction_class_entry; + ce = U_CLASS_ENTRY(dom_processinginstruction_class_entry); break; } case XML_ENTITY_REF_NODE: { - ce = dom_entityreference_class_entry; + ce = U_CLASS_ENTRY(dom_entityreference_class_entry); break; } case XML_ENTITY_DECL: case XML_ELEMENT_DECL: { - ce = dom_entity_class_entry; + ce = U_CLASS_ENTRY(dom_entity_class_entry); break; } case XML_CDATA_SECTION_NODE: { - ce = dom_cdatasection_class_entry; + ce = U_CLASS_ENTRY(dom_cdatasection_class_entry); break; } case XML_DOCUMENT_FRAG_NODE: { - ce = dom_documentfragment_class_entry; + ce = U_CLASS_ENTRY(dom_documentfragment_class_entry); break; } case XML_NOTATION_NODE: { - ce = dom_notation_class_entry; + ce = U_CLASS_ENTRY(dom_notation_class_entry); break; } case XML_NAMESPACE_DECL: { - ce = dom_namespace_node_class_entry; + ce = U_CLASS_ENTRY(dom_namespace_node_class_entry); break; } default: @@ -1221,7 +1221,7 @@ zval *php_dom_create_object(xmlNodePtr obj, int *found, zval *wrapper_in, zval * void php_dom_create_implementation(zval **retval TSRMLS_DC) { - object_init_ex(*retval, dom_domimplementation_class_entry); + object_init_ex(*retval, U_CLASS_ENTRY(dom_domimplementation_class_entry)); } /* {{{ int dom_hierarchy(xmlNodePtr parent, xmlNodePtr child) */ diff --git a/ext/dom/processinginstruction.c b/ext/dom/processinginstruction.c index 0a5947de27..7c1a2d8341 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, 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_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_std_error_handling(); return; } diff --git a/ext/dom/text.c b/ext/dom/text.c index bbf4cd9c68..799b02a3ab 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, 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_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_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, dom_text_class_entry, &offset) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, U_CLASS_ENTRY(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, dom_text_class_entry) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(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 b35580d68d..140a14c468 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, 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_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_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, 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, U_CLASS_ENTRY(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, dom_xpath_class_entry, &expr, &expr_len, &context, dom_node_class_entry) == FAILURE) { + 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) { return; } diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c index c12cef1ad6..c80f0602ed 100755 --- a/ext/pdo/pdo.c +++ b/ext/pdo/pdo.c @@ -57,7 +57,7 @@ zend_class_entry *pdo_exception_ce; PDO_API zend_class_entry *php_pdo_get_exception(void) { - return pdo_exception_ce; + return U_CLASS_ENTRY(pdo_exception_ce); } zend_class_entry *pdo_dbh_ce, *pdo_dbstmt_ce, *pdo_row_ce; diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 1130bb1b4a..2f517c1627 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -512,7 +512,7 @@ static PHP_METHOD(PDO, prepare) RETURN_FALSE; } dbstmt_ce = *pce; - if (!instanceof_function(dbstmt_ce, pdo_dbstmt_ce TSRMLS_CC)) { + if (!instanceof_function(dbstmt_ce, U_CLASS_ENTRY(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(); @@ -538,7 +538,7 @@ static PHP_METHOD(PDO, prepare) ctor_args = NULL; } } else { - dbstmt_ce = pdo_dbstmt_ce; + dbstmt_ce = U_CLASS_ENTRY(pdo_dbstmt_ce); ctor_args = NULL; } @@ -880,7 +880,7 @@ static PHP_METHOD(PDO, query) PDO_DBH_CLEAR_ERR(); - if (!pdo_stmt_instantiate(dbh, return_value, pdo_dbstmt_ce, NULL TSRMLS_CC)) { + if (!pdo_stmt_instantiate(dbh, return_value, U_CLASS_ENTRY(pdo_dbstmt_ce), NULL TSRMLS_CC)) { pdo_raise_impl_error(dbh, NULL, "HY000", "failed to instantiate user supplied statement class" TSRMLS_CC); return; } @@ -914,7 +914,7 @@ static PHP_METHOD(PDO, query) stmt->executed = 1; } if (ret) { - pdo_stmt_construct(stmt, return_value, pdo_dbstmt_ce, NULL TSRMLS_CC); + pdo_stmt_construct(stmt, return_value, U_CLASS_ENTRY(pdo_dbstmt_ce), NULL TSRMLS_CC); return; } } diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index b988598e66..fd16b0cc05 100755 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -2285,7 +2285,7 @@ static union _zend_function *row_get_ctor(zval *object TSRMLS_DC) static zend_class_entry *row_get_ce(zval *object TSRMLS_DC) { - return pdo_dbstmt_ce; + return U_CLASS_ENTRY(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/reflection/php_reflection.c b/ext/reflection/php_reflection.c index fa001dc9b9..9677a37f68 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -54,11 +54,11 @@ zend_class_entry *reflection_extension_ptr; /* Exception throwing macro */ #define _DO_THROW(msg) \ - zend_throw_exception(reflection_exception_ptr, msg, 0 TSRMLS_CC); \ + zend_throw_exception(U_CLASS_ENTRY(reflection_exception_ptr), msg, 0 TSRMLS_CC); \ return; \ #define RETURN_ON_EXCEPTION \ - if (EG(exception) && Z_OBJCE_P(EG(exception)) == reflection_exception_ptr) { \ + if (EG(exception) && Z_OBJCE_P(EG(exception)) == U_CLASS_ENTRY(reflection_exception_ptr)) { \ return; \ } @@ -870,7 +870,7 @@ ZEND_API void zend_reflection_class_factory(zend_class_entry *ce, zval *object T } else { ZVAL_STRINGL(name, ce->name, ce->name_length, 1); } - reflection_instanciate(reflection_class_ptr, object TSRMLS_CC); + reflection_instanciate(U_CLASS_ENTRY(reflection_class_ptr), object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); intern->ptr = ce; intern->free_ptr = 0; @@ -896,7 +896,7 @@ static void reflection_extension_factory(zval *object, char *name_str TSRMLS_DC) } free_alloca(lcname); - reflection_instanciate(reflection_extension_ptr, object TSRMLS_CC); + reflection_instanciate(U_CLASS_ENTRY(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); @@ -924,7 +924,7 @@ static void reflection_parameter_factory(zend_function *fptr, struct _zend_arg_i } else { ZVAL_NULL(name); } - reflection_instanciate(reflection_parameter_ptr, object TSRMLS_CC); + reflection_instanciate(U_CLASS_ENTRY(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; @@ -951,7 +951,7 @@ static void reflection_function_factory(zend_function *function, zval *object TS ZVAL_STRING(name, function->common.function_name, 1); } - reflection_instanciate(reflection_function_ptr, object TSRMLS_CC); + reflection_instanciate(U_CLASS_ENTRY(reflection_function_ptr), object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); intern->ptr = function; intern->free_ptr = 0; @@ -976,7 +976,7 @@ static void reflection_method_factory(zend_class_entry *ce, zend_function *metho ZVAL_STRING(name, method->common.function_name, 1); ZVAL_STRINGL(classname, ce->name, ce->name_length, 1); } - reflection_instanciate(reflection_method_ptr, object TSRMLS_CC); + reflection_instanciate(U_CLASS_ENTRY(reflection_method_ptr), object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); intern->ptr = method; intern->free_ptr = 0; @@ -1023,7 +1023,7 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info ZVAL_STRINGL(classname, ce->name, ce->name_length, 1); } - reflection_instanciate(reflection_property_ptr, object TSRMLS_CC); + reflection_instanciate(U_CLASS_ENTRY(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; @@ -1107,7 +1107,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 = &reflection_ptr->function_table; + fci.function_table = &U_CLASS_ENTRY(reflection_ptr)->function_table; fci.function_name = &fname; fci.object_pp = NULL; fci.retval_ptr_ptr = &retval_ptr; @@ -1150,7 +1150,7 @@ ZEND_METHOD(reflection, export) int result; zend_bool return_output = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &object, reflector_ptr, &return_output) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &object, U_CLASS_ENTRY(reflector_ptr), &return_output) == FAILURE) { return; } @@ -1222,7 +1222,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, reflection_function_ptr, 1); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_function_ptr), 1); } /* }}} */ @@ -1252,7 +1252,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Function %R() does not exist", type, name_str); return; } @@ -1446,7 +1446,7 @@ ZEND_METHOD(reflection_function, invoke) efree(params); if (result == FAILURE) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Invocation of function %v() failed", fptr->common.function_name); return; } @@ -1510,7 +1510,7 @@ ZEND_METHOD(reflection_function, invokeArgs) efree(params); if (result == FAILURE) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Invocation of function %v() failed", fptr->common.function_name); return; } @@ -1594,7 +1594,7 @@ ZEND_METHOD(reflection_function, getParameters) 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, reflection_parameter_ptr, 2); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_parameter_ptr), 2); } /* }}} */ @@ -1633,7 +1633,7 @@ ZEND_METHOD(reflection_parameter, __construct) lcname = zend_u_str_case_fold(Z_TYPE_P(reference), Z_STRVAL_P(reference), Z_STRLEN_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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Function %R() does not exist", Z_TYPE_P(reference), Z_STRVAL_P(reference)); return; } @@ -1659,7 +1659,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Class %R does not exist", Z_TYPE_PP(classref), Z_UNIVAL_PP(classref)); return; } @@ -1670,7 +1670,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(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; } @@ -1775,7 +1775,7 @@ ZEND_METHOD(reflection_parameter, getClass) if (zend_u_hash_find(EG(class_table), UG(unicode)?IS_UNICODE:IS_STRING, lcname, lcname_len + 1, (void **) &pce) == FAILURE) { efree(lcname); - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Class %v does not exist", param->arg_info->class_name); return; } @@ -1881,16 +1881,16 @@ ZEND_METHOD(reflection_parameter, getDefaultValue) if (param->fptr->type != ZEND_USER_FUNCTION) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot determine default value for internal functions"); + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Cannot determine default value for internal functions"); return; } if (param->offset < param->required) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter is not optional"); + zend_throw_exception_ex(U_CLASS_ENTRY(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(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error"); + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Internal error"); return; } @@ -1905,7 +1905,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, reflection_method_ptr, 2); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_method_ptr), 2); } /* }}} */ @@ -1940,7 +1940,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Class %v does not exist", Z_UNIVAL_P(classname)); return; } @@ -1968,7 +1968,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Method %v::%R() does not exist", ce->name, type, name_str); return; } @@ -2030,11 +2030,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(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, @@ -2095,7 +2095,7 @@ ZEND_METHOD(reflection_method, invoke) efree(params); if (result == FAILURE) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Invocation of method %v::%v() failed", mptr->common.scope->name, mptr->common.function_name); return; } @@ -2133,11 +2133,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(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, @@ -2164,7 +2164,7 @@ ZEND_METHOD(reflection_method, invokeArgs) } else { if (!object) { efree(params); - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(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; @@ -2199,7 +2199,7 @@ ZEND_METHOD(reflection_method, invokeArgs) efree(params); if (result == FAILURE) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Invocation of method %v::%v() failed", mptr->common.scope->name, mptr->common.function_name); return; } @@ -2319,7 +2319,7 @@ ZEND_METHOD(reflection_method, getDeclaringClass) 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, reflection_class_ptr, 1); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_class_ptr), 1); } /* }}} */ @@ -2365,7 +2365,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(reflection_exception_ptr, -1 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(argument)); + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), -1 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(argument)); } return; } @@ -2432,7 +2432,7 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue) if (def_value) { RETURN_ZVAL(def_value, 1, 0); } else { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Class %s does not have a property named %s", ce->name, name); } return; @@ -2463,7 +2463,7 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue) zend_update_class_constants(ce TSRMLS_CC); variable_ptr = zend_std_get_static_property(ce, name, name_len, 1 TSRMLS_CC); if (!variable_ptr) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Class %s does not have a property named %s", ce->name, name); return; } @@ -2709,7 +2709,7 @@ ZEND_METHOD(reflection_class, getMethod) efree(lc_name); } else { efree(lc_name); - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Method %R does not exist", type, name); return; } @@ -2813,7 +2813,7 @@ ZEND_METHOD(reflection_class, getProperty) if (zend_hash_find(&ce->properties_info, name, name_len + 1, (void**) &property_info) == SUCCESS && (property_info->flags & ZEND_ACC_SHADOW) == 0) { reflection_property_factory(ce, property_info, return_value TSRMLS_CC); } else { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Property %s does not exist", name); return; } @@ -3043,7 +3043,7 @@ ZEND_METHOD(reflection_class, newInstance) zend_fcall_info_cache fcc; if (!(ce->constructor->common.fn_flags & ZEND_ACC_PUBLIC)) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Access to non-public constructor of class %v", ce->name); + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Access to non-public constructor of class %v", ce->name); return; } @@ -3145,14 +3145,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Interface %s does not exist", Z_STRVAL_P(class_name)); return; } class_ce = *pce; break; case IS_OBJECT: - if (instanceof_function(Z_OBJCE_P(class_name), reflection_class_ptr TSRMLS_CC)) { + if (instanceof_function(Z_OBJCE_P(class_name), U_CLASS_ENTRY(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"); @@ -3163,7 +3163,7 @@ ZEND_METHOD(reflection_class, isSubclassOf) } /* no break */ default: - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Parameter one must either be a string or a ReflectionClass object"); return; } @@ -3192,14 +3192,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Interface %s does not exist", Z_STRVAL_P(interface)); return; } interface_ce = *pce; break; case IS_OBJECT: - if (instanceof_function(Z_OBJCE_P(interface), reflection_class_ptr TSRMLS_CC)) { + if (instanceof_function(Z_OBJCE_P(interface), U_CLASS_ENTRY(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"); @@ -3210,13 +3210,13 @@ ZEND_METHOD(reflection_class, implementsInterface) } /* no break */ default: - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Interface %v is a Class", interface_ce->name); return; } @@ -3276,7 +3276,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, reflection_object_ptr, 1); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_object_ptr), 1); } /* }}} */ @@ -3292,7 +3292,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, reflection_property_ptr, 2); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_property_ptr), 2); } /* }}} */ @@ -3325,7 +3325,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(classname)); return; } @@ -3342,7 +3342,7 @@ ZEND_METHOD(reflection_property, __construct) } if (zend_hash_find(&ce->properties_info, name_str, name_len + 1, (void **) &property_info) == FAILURE || (property_info->flags & ZEND_ACC_SHADOW)) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Property %v::$%s does not exist", ce->name, name_str); return; } @@ -3614,7 +3614,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, reflection_extension_ptr, 1); + _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_extension_ptr), 1); } /* }}} */ @@ -3643,7 +3643,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Extension %s does not exist", name_str); return; } @@ -4015,7 +4015,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(reflection_exception_ptr, 0 TSRMLS_CC, + zend_throw_exception_ex(U_CLASS_ENTRY(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 @@ -4106,20 +4106,6 @@ ZEND_API void zend_register_reflection_api(TSRMLS_D) { } /* }}} */ -void init_reflection_api(TSRMLS_D) -{ - reflection_exception_ptr = zend_get_named_class_entry("ReflectionException", sizeof("ReflectionException")-1 TSRMLS_CC); - reflection_ptr = zend_get_named_class_entry("Reflection", sizeof("Reflection")-1 TSRMLS_CC); - reflector_ptr = zend_get_named_class_entry("Reflector", sizeof("Reflector")-1 TSRMLS_CC); - reflection_function_ptr = zend_get_named_class_entry("ReflectionFunction", sizeof("ReflectionFunction")-1 TSRMLS_CC); - reflection_parameter_ptr = zend_get_named_class_entry("ReflectionParameter", sizeof("ReflectionParameter")-1 TSRMLS_CC); - reflection_method_ptr = zend_get_named_class_entry("ReflectionMethod", sizeof("ReflectionMethod")-1 TSRMLS_CC); - reflection_class_ptr = zend_get_named_class_entry("ReflectionClass", sizeof("ReflectionClass")-1 TSRMLS_CC); - reflection_object_ptr = zend_get_named_class_entry("ReflectionObject", sizeof("ReflectionObject")-1 TSRMLS_CC); - reflection_property_ptr = zend_get_named_class_entry("ReflectionProperty", sizeof("ReflectionProperty")-1 TSRMLS_CC); - reflection_extension_ptr = zend_get_named_class_entry("ReflectionExtension", sizeof("ReflectionExtension")-1 TSRMLS_CC); -} - /* * Local variables: * tab-width: 4 diff --git a/ext/reflection/php_reflection.h b/ext/reflection/php_reflection.h index a16ed9b7f9..fb06af4687 100644 --- a/ext/reflection/php_reflection.h +++ b/ext/reflection/php_reflection.h @@ -26,8 +26,6 @@ BEGIN_EXTERN_C() ZEND_API void zend_register_reflection_api(TSRMLS_D); ZEND_API void zend_reflection_class_factory(zend_class_entry *ce, zval *object TSRMLS_DC); -void init_reflection_api(TSRMLS_D); - END_EXTERN_C() #endif diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 4382016c81..4075472e7d 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -42,7 +42,7 @@ zend_class_entry *sxe_class_entry = NULL; ZEND_API zend_class_entry *sxe_get_element_class_entry() { - return sxe_class_entry; + return U_CLASS_ENTRY(sxe_class_entry); } #define SXE_ME(func, arg_info, flags) PHP_ME(simplexml_element, func, arg_info, flags) @@ -1271,7 +1271,7 @@ PHP_FUNCTION(simplexml_load_file) xmlDocPtr docp; char *classname = ""; int classname_len = 0, options=0; - zend_class_entry *ce= sxe_class_entry; + zend_class_entry *ce= U_CLASS_ENTRY(sxe_class_entry); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sl", &filename, &filename_len, &classname, &classname_len, &options) == FAILURE) { return; @@ -1314,7 +1314,7 @@ PHP_FUNCTION(simplexml_load_string) xmlDocPtr docp; char *classname = ""; int classname_len = 0, options=0; - zend_class_entry *ce= sxe_class_entry; + zend_class_entry *ce= U_CLASS_ENTRY(sxe_class_entry); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sl", &data, &data_len, &classname, &classname_len, &options) == FAILURE) { return; @@ -1600,7 +1600,7 @@ PHP_FUNCTION(simplexml_import_dom) xmlNodePtr nodep = NULL; char *classname = ""; int classname_len = 0; - zend_class_entry *ce= sxe_class_entry; + zend_class_entry *ce= U_CLASS_ENTRY(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 7f5a3f4086..ea8c1f4ea2 100755 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -293,7 +293,7 @@ PHP_FUNCTION(spl_autoload) EG(function_state_ptr) = original_function_state_ptr; if (!found) { - zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Class %s could not be loaded", class_name); + zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Class %s could not be loaded", class_name); } } /* }}} */ @@ -386,7 +386,7 @@ PHP_FUNCTION(spl_autoload_register) } if (!zend_is_callable_ex(zcallable, 0, &func_name, &func_name_len, &alfi.func_ptr, &obj_ptr TSRMLS_CC)) { if (do_throw) { - zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Passed array does not specify a callable static method"); + zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Passed array does not specify a callable static method"); } if (func_name) { efree(func_name); @@ -394,7 +394,7 @@ PHP_FUNCTION(spl_autoload_register) return; } else if (!obj_ptr && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) { if (do_throw) { - zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Passed array specifies a non static method but no object"); + zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Passed array specifies a non static method but no object"); } if (func_name) { efree(func_name); @@ -420,7 +420,7 @@ PHP_FUNCTION(spl_autoload_register) if (!strcmp(lc_name, "spl_autoload_call")) { if (do_throw) { - zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Function spl_autoload_call() cannot be registered", func_name); + zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Function spl_autoload_call() cannot be registered", func_name); } free_alloca(lc_name); return; @@ -428,7 +428,7 @@ PHP_FUNCTION(spl_autoload_register) if (zend_hash_find(EG(function_table), lc_name, func_name_len+1, (void **) &alfi.func_ptr) == FAILURE) { if (do_throw) { - zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Function '%s' not found", func_name); + zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Function '%s' not found", func_name); } free_alloca(lc_name); return; diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 2c24030e9e..1dc9f21f1e 100755 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -244,10 +244,10 @@ static zend_object_value spl_array_object_new_ex(zend_class_entry *class_type, s retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) spl_array_object_free_storage, NULL TSRMLS_CC); while (parent) { - if (parent == spl_ce_ArrayIterator) { + if (parent == U_CLASS_ENTRY(spl_ce_ArrayIterator)) { retval.handlers = &spl_handler_ArrayIterator; break; - } else if (parent == spl_ce_ArrayObject) { + } else if (parent == U_CLASS_ENTRY(spl_ce_ArrayObject)) { retval.handlers = &spl_handler_ArrayObject; break; } @@ -876,7 +876,7 @@ SPL_METHOD(Array, __construct) if (ZEND_NUM_ARGS() == 0) { return; /* nothing to do */ } - php_set_error_handling(EH_THROW, spl_ce_InvalidArgumentException TSRMLS_CC); + php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_InvalidArgumentException) TSRMLS_CC); intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); @@ -899,7 +899,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(spl_ce_InvalidArgumentException, "Passed variable is not an array or object, using empty array instead", 0 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); return; } zval_ptr_dtor(&intern->array); @@ -970,7 +970,7 @@ SPL_METHOD(Array, exchangeArray) intern->array = other->array; } else { if (Z_TYPE_PP(array) != IS_OBJECT && !HASH_OF(*array)) { - zend_throw_exception(spl_ce_InvalidArgumentException, "Passed variable is not an array or object, using empty array instead", 0 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); return; } zval_ptr_dtor(&intern->array); @@ -1002,7 +1002,7 @@ SPL_METHOD(Array, getIterator) } return_value->type = IS_OBJECT; - return_value->value.obj = spl_array_object_new_ex(spl_ce_ArrayIterator, &iterator, object TSRMLS_CC); + return_value->value.obj = spl_array_object_new_ex(U_CLASS_ENTRY(spl_ce_ArrayIterator), &iterator, object TSRMLS_CC); return_value->refcount = 1; return_value->is_ref = 1; } @@ -1053,7 +1053,7 @@ SPL_METHOD(Array, seek) } } } - zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Seek position %ld is out of range", opos); + zend_throw_exception_ex(U_CLASS_ENTRY(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) /* {{{ */ diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index fd7628440a..964919d97f 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -191,7 +191,7 @@ SPL_METHOD(DirectoryIterator, __construct) char *path; int len; - php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); + php_set_error_handling(EH_THROW, U_CLASS_ENTRY(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); @@ -437,10 +437,10 @@ SPL_METHOD(DirectoryIterator, openFile) spl_file_object *intern; zend_bool use_include_path = 0; - php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); + php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_RuntimeException) TSRMLS_CC); if (!dir_obj->entry.d_name[0]) { - zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Could not open file"); + zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, "Could not open file"); zval_dtor(return_value); return; } @@ -945,7 +945,7 @@ static int spl_file_object_read(spl_file_object *intern, int silent TSRMLS_DC) / if (php_stream_eof(intern->stream)) { if (!silent) { - zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot read from file %s", intern->file_name); + zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, "Cannot read from file %s", intern->file_name); } return FAILURE; } @@ -982,7 +982,7 @@ static int spl_file_object_read_line(zval * this_ptr, spl_file_object *intern, i if (intern->func_getCurr->common.scope != spl_ce_FileObject) { if (php_stream_eof(intern->stream)) { if (!silent) { - zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot read from file %s", intern->file_name); + zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, "Cannot read from file %s", intern->file_name); } return FAILURE; } @@ -1012,7 +1012,7 @@ static int spl_file_object_read_line(zval * this_ptr, spl_file_object *intern, i static void spl_file_object_rewind(spl_file_object *intern TSRMLS_DC) /* {{{ */ { if (-1 == php_stream_rewind(intern->stream)) { - zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot rewind file %s", intern->file_name); + zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, "Cannot rewind file %s", intern->file_name); } else { spl_file_object_free_line(intern TSRMLS_CC); intern->current_line_num = 0; @@ -1026,7 +1026,7 @@ static int spl_file_object_open(spl_file_object *intern, int use_include_path, i if (intern->stream == NULL) { if (!EG(exception)) { - zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot open file %s", intern->file_name); + zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, "Cannot open file %s", intern->file_name); } return FAILURE; } @@ -1054,7 +1054,7 @@ SPL_METHOD(FileObject, __construct) spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zend_bool use_include_path = 0; - php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); + php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_RuntimeException) TSRMLS_CC); intern->open_mode = "r"; intern->open_mode_len = 1; @@ -1191,7 +1191,7 @@ SPL_METHOD(FileObject, setMaxLineLen) } if (max_len < 0) { - zend_throw_exception_ex(spl_ce_DomainException, 0 TSRMLS_CC, "Maximum line length must be greater than or equal zero"); + zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_DomainException), 0 TSRMLS_CC, "Maximum line length must be greater than or equal zero"); return; } @@ -1455,7 +1455,7 @@ SPL_METHOD(FileObject, ftruncate) } if (!php_stream_truncate_supported(intern->stream)) { - zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Can't truncate file %s", intern->file_name); + zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Can't truncate file %s", intern->file_name); RETURN_FALSE; } @@ -1473,7 +1473,7 @@ SPL_METHOD(FileObject, seek) return; } if (line_pos < 0) { - zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Can't seek file %s to negative line %ld", intern->file_name, line_pos); + 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); RETURN_FALSE; } diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 130acfcf89..f7c669a40d 100755 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -241,11 +241,11 @@ next_step: } ce = child && Z_TYPE_P(child) == IS_OBJECT ? Z_OBJCE_P(child) : NULL; - if (!ce || !instanceof_function(ce, spl_ce_RecursiveIterator TSRMLS_CC)) { + if (!ce || !instanceof_function(ce, U_CLASS_ENTRY(spl_ce_RecursiveIterator) TSRMLS_CC)) { if (child) { zval_ptr_dtor(&child); } - zend_throw_exception(spl_ce_UnexpectedValueException, "Objects returned by RecursiveIterator::getChildren() must implement RecursiveIterator", 0 TSRMLS_CC); + zend_throw_exception(U_CLASS_ENTRY(spl_ce_UnexpectedValueException), "Objects returned by RecursiveIterator::getChildren() must implement RecursiveIterator", 0 TSRMLS_CC); return; } if (object->mode == RIT_CHILD_FIRST) { @@ -289,7 +289,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 != spl_ce_RecursiveIteratorIterator) { + if (!object->endChildren || object->endChildren->common.scope != U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { zend_call_method_with_0_params(&zthis, object->ce, &object->endChildren, "endchildren", NULL); } } @@ -343,19 +343,19 @@ SPL_METHOD(RecursiveIteratorIterator, __construct) zend_class_entry *ce_iterator; long mode = RIT_LEAVES_ONLY, flags = 0; - php_set_error_handling(EH_THROW, spl_ce_InvalidArgumentException TSRMLS_CC); + php_set_error_handling(EH_THROW, U_CLASS_ENTRY(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), zend_ce_aggregate TSRMLS_CC)) { + if (instanceof_function(Z_OBJCE_P(iterator), U_CLASS_ENTRY(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); } } else { iterator = NULL; } - if (!iterator || !instanceof_function(Z_OBJCE_P(iterator), spl_ce_RecursiveIterator TSRMLS_CC)) { + if (!iterator || !instanceof_function(Z_OBJCE_P(iterator), U_CLASS_ENTRY(spl_ce_RecursiveIterator) TSRMLS_CC)) { php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); - zend_throw_exception(spl_ce_InvalidArgumentException, "An instance of RecursiveIterator or IteratorAggregate creating it is required", 0 TSRMLS_CC); + zend_throw_exception(U_CLASS_ENTRY(spl_ce_InvalidArgumentException), "An instance of RecursiveIterator or IteratorAggregate creating it is required", 0 TSRMLS_CC); return; } @@ -366,19 +366,19 @@ SPL_METHOD(RecursiveIteratorIterator, __construct) intern->flags = flags; intern->ce = Z_OBJCE_P(object); zend_hash_find(&intern->ce->function_table, "callhaschildren", sizeof("callHasChildren"), (void **) &intern->callHasChildren); - if (intern->callHasChildren->common.scope == spl_ce_RecursiveIteratorIterator) { + if (intern->callHasChildren->common.scope == U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { intern->callHasChildren = NULL; } zend_hash_find(&intern->ce->function_table, "callgetchildren", sizeof("callGetChildren"), (void **) &intern->callGetChildren); - if (intern->callGetChildren->common.scope == spl_ce_RecursiveIteratorIterator) { + if (intern->callGetChildren->common.scope == U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { intern->callGetChildren = NULL; } zend_hash_find(&intern->ce->function_table, "beginchildren", sizeof("beginchildren"), (void **) &intern->beginChildren); - if (intern->beginChildren->common.scope == spl_ce_RecursiveIteratorIterator) { + if (intern->beginChildren->common.scope == U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { intern->beginChildren = NULL; } zend_hash_find(&intern->ce->function_table, "endchildren", sizeof("endchildren"), (void **) &intern->endChildren); - if (intern->endChildren->common.scope == spl_ce_RecursiveIteratorIterator) { + if (intern->endChildren->common.scope == U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { intern->endChildren = NULL; } ce_iterator = Z_OBJCE_P(iterator); /* respect inheritance, don't use spl_ce_RecursiveIterator */ @@ -711,7 +711,7 @@ static INLINE spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAME spl_dual_it_object *intern; zend_class_entry *ce; - php_set_error_handling(EH_THROW, spl_ce_InvalidArgumentException TSRMLS_CC); + php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_InvalidArgumentException) TSRMLS_CC); intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); @@ -726,12 +726,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(spl_ce_OutOfRangeException, "Parameter offset must be > 0", 0 TSRMLS_CC); + zend_throw_exception(U_CLASS_ENTRY(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(spl_ce_OutOfRangeException, "Parameter count must either be -1 or a value greater than or equal 0", 0 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); return NULL; } break; @@ -756,19 +756,19 @@ static INLINE spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAME return NULL; } ce = Z_OBJCE_P(zobject); - if (!instanceof_function(ce, zend_ce_iterator TSRMLS_CC)) { + if (!instanceof_function(ce, U_CLASS_ENTRY(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(spl_ce_LogicException, "Class to downcast to not found or not base class or does not implement Traversable", 0 TSRMLS_CC); + 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); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return NULL; } ce = *pce_cast; } - if (instanceof_function(ce, zend_ce_aggregate TSRMLS_CC)) { + if (instanceof_function(ce, U_CLASS_ENTRY(zend_ce_aggregate) TSRMLS_CC)) { zval *retval; zobject = zend_call_method_with_0_params(&zobject, ce, &ce->iterator_funcs.zf_new_iterator, "getiterator", &retval); ce = Z_OBJCE_P(zobject); @@ -777,9 +777,9 @@ static INLINE spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAME break; } case DIT_AppendIterator: - 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 TSRMLS_CC); + 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 TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); return intern; default: @@ -806,7 +806,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, zend_ce_iterator, DIT_Default); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_iterator), DIT_Default); } /* }}} */ /* {{{ proto Iterator FilterIterator::getInnerIterator() @@ -1046,7 +1046,7 @@ SPL_METHOD(FilterIterator, next) Create a RecursiveFilterIterator from a RecursiveIterator */ SPL_METHOD(RecursiveFilterIterator, __construct) { - spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_RecursiveIterator, DIT_Default); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(spl_ce_RecursiveIterator), DIT_Default); } /* }}} */ /* {{{ proto boolean RecursiveFilterIterator::hasChildren() @@ -1072,7 +1072,7 @@ SPL_METHOD(RecursiveFilterIterator, getChildren) intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval); - spl_instantiate_arg_ex1(spl_ce_RecursiveFilterIterator, &return_value, 0, retval TSRMLS_CC); + spl_instantiate_arg_ex1(U_CLASS_ENTRY(spl_ce_RecursiveFilterIterator), &return_value, 0, retval TSRMLS_CC); zval_ptr_dtor(&retval); } /* }}} */ @@ -1080,7 +1080,7 @@ SPL_METHOD(RecursiveFilterIterator, getChildren) Create a ParentIterator from a RecursiveIterator */ SPL_METHOD(ParentIterator, __construct) { - spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_RecursiveIterator, DIT_Default); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(spl_ce_RecursiveIterator), DIT_Default); } /* }}} */ /* {{{ proto boolean ParentIterator::hasChildren() @@ -1106,7 +1106,7 @@ SPL_METHOD(ParentIterator, getChildren) intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval); - spl_instantiate_arg_ex1(spl_ce_ParentIterator, &return_value, 0, retval TSRMLS_CC); + spl_instantiate_arg_ex1(U_CLASS_ENTRY(spl_ce_ParentIterator), &return_value, 0, retval TSRMLS_CC); zval_ptr_dtor(&retval); } /* }}} */ @@ -1212,14 +1212,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(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(U_CLASS_ENTRY(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(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(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); return; } - if (instanceof_function(intern->inner.ce, spl_ce_SeekableIterator TSRMLS_CC)) { + if (instanceof_function(intern->inner.ce, U_CLASS_ENTRY(spl_ce_SeekableIterator) TSRMLS_CC)) { MAKE_STD_ZVAL(zpos); ZVAL_LONG(zpos, pos); spl_dual_it_free(intern TSRMLS_CC); @@ -1248,7 +1248,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, zend_ce_iterator, DIT_LimitIterator); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_iterator), DIT_LimitIterator); } /* }}} */ /* {{{ proto void LimitIterator::rewind() @@ -1375,7 +1375,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(spl_ce_CachingRecursiveIterator, &intern->u.caching.zchildren, 1, zchildren, &zflags TSRMLS_CC); + spl_instantiate_arg_ex2(U_CLASS_ENTRY(spl_ce_CachingRecursiveIterator), &intern->u.caching.zchildren, 1, zchildren, &zflags TSRMLS_CC); zval_ptr_dtor(&zchildren); } } @@ -1440,7 +1440,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, zend_ce_iterator, DIT_CachingIterator); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_iterator), DIT_CachingIterator); } /* }}} */ /* {{{ proto void CachingIterator::rewind() @@ -1496,7 +1496,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)) { - zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%v does not fetch string value (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); + 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); } if (intern->u.caching.zstr) { RETURN_STRINGL(Z_STRVAL_P(intern->u.caching.zstr), Z_STRLEN_P(intern->u.caching.zstr), 1); @@ -1528,7 +1528,7 @@ static zend_function_entry spl_funcs_CachingIterator[] = { Create an iterator from a RecursiveIterator */ SPL_METHOD(CachingRecursiveIterator, __construct) { - spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_RecursiveIterator, DIT_CachingRecursiveIterator); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(spl_ce_RecursiveIterator), DIT_CachingRecursiveIterator); } /* }}} */ /* {{{ proto bolean CachingRecursiveIterator::hasChildren() @@ -1574,7 +1574,7 @@ static zend_function_entry spl_funcs_CachingRecursiveIterator[] = { Create an iterator from anything that is traversable */ SPL_METHOD(IteratorIterator, __construct) { - spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_traversable, DIT_IteratorIterator); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_traversable), DIT_IteratorIterator); } /* }}} */ static @@ -1597,7 +1597,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, zend_ce_iterator, DIT_NoRewindIterator); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_iterator), DIT_NoRewindIterator); } /* }}} */ /* {{{ proto void NoRewindIterator::rewind() @@ -1681,7 +1681,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, zend_ce_iterator, DIT_InfiniteIterator); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_iterator), DIT_InfiniteIterator); } /* }}} */ /* {{{ proto InfiniteIterator::next() @@ -1726,14 +1726,14 @@ SPL_METHOD(EmptyIterator, valid) Throws exception */ SPL_METHOD(EmptyIterator, key) { - zend_throw_exception(spl_ce_BadMethodCallException, "Accessing the key of an EmptyIterator", 0 TSRMLS_CC); + zend_throw_exception(U_CLASS_ENTRY(spl_ce_BadMethodCallException), "Accessing the key of an EmptyIterator", 0 TSRMLS_CC); } /* }}} */ /* {{{ proto EmptyIterator::current() Throws exception */ SPL_METHOD(EmptyIterator, current) { - zend_throw_exception(spl_ce_BadMethodCallException, "Accessing the value of an EmptyIterator", 0 TSRMLS_CC); + zend_throw_exception(U_CLASS_ENTRY(spl_ce_BadMethodCallException), "Accessing the value of an EmptyIterator", 0 TSRMLS_CC); } /* }}} */ /* {{{ proto EmptyIterator::next() @@ -1801,7 +1801,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, zend_ce_iterator, DIT_AppendIterator); + spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_iterator), DIT_AppendIterator); } /* }}} */ /* {{{ proto void AppendIterator::append(Iterator it) @@ -1813,7 +1813,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, zend_ce_iterator) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &it, U_CLASS_ENTRY(zend_ce_iterator)) == FAILURE) { return; } spl_array_iterator_append(intern->u.append.zarrayit, it TSRMLS_CC); @@ -1893,7 +1893,7 @@ PHP_FUNCTION(iterator_to_array) ulong int_key; int key_type; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &obj, zend_ce_traversable) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &obj, U_CLASS_ENTRY(zend_ce_traversable)) == FAILURE) { RETURN_FALSE; } @@ -1929,7 +1929,7 @@ PHP_FUNCTION(iterator_count) zend_object_iterator *iter; long count = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &obj, zend_ce_aggregate) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &obj, U_CLASS_ENTRY(zend_ce_aggregate)) == FAILURE) { RETURN_FALSE; } -- 2.40.0