Made server wide switch for unicode on/off (according to PDM).

This commit is contained in:
Dmitry Stogov 2006-02-13 10:23:59 +00:00
parent 5a4b6845dc
commit 09ca61c125
59 changed files with 644 additions and 805 deletions

View file

@ -29,7 +29,18 @@
#include "zend_builtin_functions.h" #include "zend_builtin_functions.h"
#include "zend_ini.h" #include "zend_ini.h"
#include "zend_unicode.h" #include "zend_unicode.h"
#include "zend_interfaces.h"
#ifdef ZTS
# define GLOBAL_FUNCTION_TABLE global_function_table
# define GLOBAL_CLASS_TABLE global_class_table
# define GLOBAL_CONSTANTS_TABLE global_constants_table
# define GLOBAL_AUTO_GLOBALS_TABLE global_auto_globals_table
#else
# define GLOBAL_FUNCTION_TABLE CG(function_table)
# define GLOBAL_CLASS_TABLE CG(class_table)
# define GLOBAL_AUTO_GLOBALS_TABLE CG(auto_globals)
# define GLOBAL_CONSTANTS_TABLE EG(zend_constants)
#endif
#if defined(ZEND_WIN32) && ZEND_DEBUG #if defined(ZEND_WIN32) && ZEND_DEBUG
BOOL WINAPI IsDebuggerPresent(VOID); BOOL WINAPI IsDebuggerPresent(VOID);
@ -211,16 +222,12 @@ ZEND_INI_END()
ZEND_API int compiler_globals_id; ZEND_API int compiler_globals_id;
ZEND_API int executor_globals_id; ZEND_API int executor_globals_id;
ZEND_API int alloc_globals_id; ZEND_API int alloc_globals_id;
#endif
static HashTable *global_function_table = NULL; static HashTable *global_function_table = NULL;
static HashTable *global_class_table = NULL; static HashTable *global_class_table = NULL;
static HashTable *global_constants_table = NULL; static HashTable *global_constants_table = NULL;
static HashTable *global_auto_globals_table = NULL; static HashTable *global_auto_globals_table = NULL;
static HashTable *global_u_function_table = NULL;
static HashTable *global_u_class_table = NULL;
static HashTable *global_u_constants_table = NULL;
static HashTable *global_u_auto_globals_table = NULL;
static HashTable *global_persistent_list = NULL; static HashTable *global_persistent_list = NULL;
#endif
ZEND_API zend_utility_values zend_uv; ZEND_API zend_utility_values zend_uv;
@ -648,13 +655,12 @@ static void zend_set_default_compile_time_values(TSRMLS_D)
static void zval_copy_persistent(zval *zv) static void zval_copy_persistent(zval *zv)
{ {
if (Z_TYPE_P(zv) == IS_UNICODE) { if (Z_TYPE_P(zv) == IS_STRING || Z_TYPE_P(zv) == IS_CONSTANT) {
Z_USTRVAL_P(zv) = zend_ustrndup(Z_USTRVAL_P(zv), Z_USTRLEN_P(zv));
} else if (Z_TYPE_P(zv) == IS_STRING || Z_TYPE_P(zv) == IS_CONSTANT) {
UChar *ustr; UChar *ustr;
ustr = malloc(UBYTES(Z_STRLEN_P(zv)+1)); ustr = malloc(UBYTES(Z_STRLEN_P(zv)+1));
u_charsToUChars(Z_STRVAL_P(zv), ustr, Z_STRLEN_P(zv)+1); u_charsToUChars(Z_STRVAL_P(zv), ustr, Z_STRLEN_P(zv)+1);
free(Z_STRVAL_P(zv));
Z_USTRVAL_P(zv) = ustr; Z_USTRVAL_P(zv) = ustr;
if (Z_TYPE_P(zv) == IS_STRING) Z_TYPE_P(zv) = IS_UNICODE; if (Z_TYPE_P(zv) == IS_STRING) Z_TYPE_P(zv) = IS_UNICODE;
} }
@ -696,15 +702,7 @@ static void free_u_zend_constant(zend_constant *c)
free(c->name); free(c->name);
} }
static void copy_u_zend_constant(zend_constant *c) static void function_to_unicode(zend_function *func TSRMLS_DC)
{
c->name = (char*)zend_ustrndup((UChar*)c->name, c->name_len - 1);
if (!(c->flags & CONST_PERSISTENT)) {
zval_copy_ctor(&c->value);
}
}
static void function_to_unicode(zend_function *func)
{ {
if (func->common.function_name) { if (func->common.function_name) {
UChar *uname; UChar *uname;
@ -737,26 +735,22 @@ static void function_to_unicode(zend_function *func)
} }
} }
static void property_info_to_unicode(zend_property_info *info) static void property_info_to_unicode(zend_property_info *info TSRMLS_DC)
{ {
if (info->name) { if (info->name) {
UChar *uname; UChar *uname;
uname = malloc(UBYTES(info->name_length+1)); uname = malloc(UBYTES(info->name_length+1));
u_charsToUChars(info->name, uname, info->name_length+1); u_charsToUChars(info->name, uname, info->name_length+1);
free(info->name);
info->name = (char*)uname; info->name = (char*)uname;
info->h = zend_u_get_hash_value(IS_UNICODE, info->name, info->name_length+1); info->h = zend_u_get_hash_value(IS_UNICODE, info->name, info->name_length+1);
} }
} }
static void zval_ptr_to_unicode(zval **zv) static void zval_ptr_to_unicode(zval **zv TSRMLS_DC)
{ {
zval *new_zv = malloc(sizeof(zval)); zval_copy_persistent(*zv);
memcpy(new_zv, *zv, sizeof(zval));
new_zv->refcount = 1;
zval_copy_persistent(new_zv);
*zv = new_zv;
} }
static void const_to_unicode(zend_constant *c) static void const_to_unicode(zend_constant *c)
@ -766,157 +760,36 @@ static void const_to_unicode(zend_constant *c)
if (c->name) { if (c->name) {
uname = malloc(UBYTES(c->name_len)); uname = malloc(UBYTES(c->name_len));
u_charsToUChars(c->name, uname, c->name_len); u_charsToUChars(c->name, uname, c->name_len);
free(c->name);
c->name = (char*)uname; c->name = (char*)uname;
} }
zval_copy_persistent(&c->value); if (Z_TYPE(c->value) == IS_STRING || Z_TYPE(c->value) == IS_CONSTANT) {
UChar *ustr;
ustr = malloc(UBYTES(Z_STRLEN(c->value)+1));
u_charsToUChars(Z_STRVAL(c->value), ustr, Z_STRLEN(c->value)+1);
Z_USTRVAL(c->value) = ustr;
if (Z_TYPE(c->value) == IS_STRING) Z_TYPE(c->value) = IS_UNICODE;
}
} }
static void class_to_unicode(zend_class_entry **ce) static void class_to_unicode(zend_class_entry **ce TSRMLS_DC)
{ {
zend_class_entry *new_ce = malloc(sizeof(zend_class_entry));
zend_property_info tmp_info;
zval* tmp_zval;
memcpy(new_ce, *ce, sizeof(zend_class_entry));
(*ce)->u_twin = new_ce;
/* Convert name to unicode */ /* Convert name to unicode */
if (new_ce->name) { if ((*ce)->name) {
UChar *uname = malloc(UBYTES(new_ce->name_length+1)); UChar *uname = malloc(UBYTES((*ce)->name_length+1));
u_charsToUChars(new_ce->name, uname, new_ce->name_length+1); u_charsToUChars((*ce)->name, uname, (*ce)->name_length+1);
new_ce->name = (char*)uname; free((*ce)->name);
} (*ce)->name = (char*)uname;
/* Copy methods */
zend_u_hash_init_ex(&new_ce->function_table, (*ce)->function_table.nNumOfElements, NULL, ZEND_U_FUNCTION_DTOR, 1, 1, 0);
{
Bucket *p = (*ce)->function_table.pListHead;
while (p != NULL) {
zend_function *src = (zend_function*)p->pData;
zend_function *target;
zend_function tmp_func = *src;
function_to_unicode(&tmp_func);
zend_hash_add(&new_ce->function_table, p->key.u.string, p->nKeyLength, &tmp_func, sizeof(zend_function), (void**)&target);
src->common.u_twin = target;
p = p->pListNext;
}
}
/*
zend_hash_copy(&new_ce->function_table, &(*ce)->function_table, (copy_ctor_func_t) function_to_unicode, &tmp_func, sizeof(zend_function));
*/
/* Copy constants */
zend_u_hash_init_ex(&new_ce->constants_table, (*ce)->constants_table.nNumOfElements, NULL, (*ce)->constants_table.pDestructor, 1, 1, 0);
zend_hash_copy(&new_ce->constants_table, &(*ce)->constants_table, (copy_ctor_func_t) zval_ptr_to_unicode, &tmp_zval, sizeof(zval*));
/* Copy properties */
zend_u_hash_init_ex(&new_ce->properties_info, (*ce)->properties_info.nNumOfElements, NULL, (*ce)->properties_info.pDestructor/*(dtor_func_t)zend_destroy_property_info_internal*/, 1, 1, 0);
zend_hash_copy(&new_ce->properties_info, &(*ce)->properties_info, (copy_ctor_func_t) property_info_to_unicode, &tmp_info, sizeof(zend_property_info));
zend_u_hash_init_ex(&new_ce->default_properties, (*ce)->default_properties.nNumOfElements, NULL, (*ce)->default_properties.pDestructor, 1, 1, 0);
zend_hash_copy(&new_ce->default_properties, &(*ce)->default_properties, (copy_ctor_func_t) zval_ptr_to_unicode, &tmp_zval, sizeof(zval*));
zend_u_hash_init_ex(&new_ce->default_static_members, (*ce)->default_static_members.nNumOfElements, NULL, (*ce)->default_static_members.pDestructor, 1, 1, 0);
{
HashPosition pos;
zval **p;
zend_hash_internal_pointer_reset_ex(&(*ce)->default_static_members, &pos);
while (zend_hash_get_current_data_ex(&(*ce)->default_static_members, (void**)&p, &pos) == SUCCESS) {
char *str_index;
uint str_length;
ulong num_index;
zval **q;
zend_hash_get_current_key_ex(&(*ce)->default_static_members, &str_index, &str_length, &num_index, 0, &pos);
if ((*p)->is_ref &&
(*ce)->parent &&
zend_hash_find(&(*ce)->parent->default_static_members, str_index, str_length, (void**)&q) == SUCCESS &&
*p == *q &&
zend_hash_find(&new_ce->parent->u_twin->default_static_members, str_index, str_length, (void**)&q) == SUCCESS) {
(*q)->refcount++;
(*q)->is_ref = 1;
zend_hash_add(&new_ce->default_static_members, str_index, str_length, (void**)q, sizeof(zval*), NULL);
} else {
zval *q = *p;
zval_ptr_to_unicode(&q);
q->is_ref = 0;
zend_hash_add(&new_ce->default_static_members, str_index, str_length, (void**)&q, sizeof(zval*), NULL);
}
zend_hash_move_forward_ex(&(*ce)->default_static_members, &pos);
}
}
*ce = new_ce;
}
static void fix_classes(HashTable *ht) {
Bucket *p = ht->pListHead;
Bucket *q;
/* Fix parent classes */
while (p != NULL) {
zend_class_entry *ce = *(zend_class_entry**)p->pData;
if (ce->parent) {
ce->parent = ce->parent->u_twin;
}
if (ce->num_interfaces > 0 && ce->interfaces) {
int i = sizeof(zend_class_entry*)*ce->num_interfaces;
zend_class_entry **new_interfaces;
new_interfaces = (zend_class_entry**)malloc(i);
memcpy(new_interfaces, ce->interfaces, i);
ce->interfaces = new_interfaces;
for (i = 0; i < ce->num_interfaces; i++) {
ce->interfaces[i] = ce->interfaces[i]->u_twin;
}
}
q = ce->function_table.pListHead;
while (q != NULL) {
zend_function *f = (zend_function*)q->pData;
if (f->common.scope) {
f->common.scope = f->common.scope->u_twin;
}
if (f->common.prototype) {
f->common.prototype = f->common.prototype->common.u_twin;
}
q = q->pListNext;
}
if (ce->constructor) {
ce->constructor = ce->constructor->common.u_twin;
} else if (ce->destructor) {
ce->destructor = ce->destructor->common.u_twin;
} else if (ce->clone) {
ce->clone = ce->clone->common.u_twin;
} else if (ce->__get) {
ce->__get = ce->__get->common.u_twin;
} else if (ce->__set) {
ce->__set = ce->__set->common.u_twin;
} else if (ce->__unset) {
ce->__unset = ce->__unset->common.u_twin;
} else if (ce->__isset) {
ce->__isset = ce->__isset->common.u_twin;
} else if (ce->__call) {
ce->__call = ce->__call->common.u_twin;
} else if (ce->__tostring) {
ce->__tostring = ce->__tostring->common.u_twin;
} else if (ce->serialize_func) {
ce->serialize_func = ce->serialize_func->common.u_twin;
} else if (ce->unserialize_func) {
ce->unserialize_func = ce->unserialize_func->common.u_twin;
}
p = p->pListNext;
} }
zend_hash_to_unicode(&(*ce)->function_table, (apply_func_t)function_to_unicode TSRMLS_CC);
(*ce)->function_table.pDestructor = ZEND_U_FUNCTION_DTOR;
zend_hash_to_unicode(&(*ce)->constants_table, (apply_func_t)zval_ptr_to_unicode TSRMLS_CC);
zend_hash_to_unicode(&(*ce)->properties_info, (apply_func_t)property_info_to_unicode TSRMLS_CC);
zend_hash_to_unicode(&(*ce)->default_properties, (apply_func_t)zval_ptr_to_unicode TSRMLS_CC);
zend_hash_to_unicode(&(*ce)->default_static_members, (apply_func_t)zval_ptr_to_unicode TSRMLS_CC);
} }
#ifdef ZTS #ifdef ZTS
@ -927,46 +800,23 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS
compiler_globals->compiled_filename = NULL; compiler_globals->compiled_filename = NULL;
compiler_globals->global_function_table = compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable)); compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable));
zend_u_hash_init_ex(compiler_globals->function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0, 0); zend_u_hash_init_ex(compiler_globals->function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, UG(unicode), 0);
zend_hash_copy(compiler_globals->function_table, global_function_table, NULL, &tmp_func, sizeof(zend_function)); zend_hash_copy(compiler_globals->function_table, global_function_table, NULL, &tmp_func, sizeof(zend_function));
if (global_u_function_table) { compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
compiler_globals->global_u_function_table = (HashTable *) malloc(sizeof(HashTable)); zend_u_hash_init_ex(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1, UG(unicode), 0);
zend_u_hash_init_ex(compiler_globals->global_u_function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, 1, 0);
zend_hash_copy(compiler_globals->global_u_function_table, global_u_function_table, NULL, &tmp_func, sizeof(zend_function));
} else {
compiler_globals->global_u_function_table = 0;
}
compiler_globals->global_class_table = compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
zend_u_hash_init_ex(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0, 0);
zend_hash_copy(compiler_globals->class_table, global_class_table, (copy_ctor_func_t) zend_class_add_ref, &tmp_class, sizeof(zend_class_entry *)); zend_hash_copy(compiler_globals->class_table, global_class_table, (copy_ctor_func_t) zend_class_add_ref, &tmp_class, sizeof(zend_class_entry *));
if (global_u_class_table) {
compiler_globals->global_u_class_table = (HashTable *) malloc(sizeof(HashTable));
zend_u_hash_init_ex(compiler_globals->global_u_class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 1, 0);
zend_hash_copy(compiler_globals->global_u_class_table, global_u_class_table, (copy_ctor_func_t) zend_class_add_ref, &tmp_class, sizeof(zend_class_entry *));
} else {
compiler_globals->global_u_class_table = NULL;
}
zend_set_default_compile_time_values(TSRMLS_C); zend_set_default_compile_time_values(TSRMLS_C);
CG(interactive) = 0; CG(interactive) = 0;
CG(literal_type) = IS_STRING; CG(literal_type) = IS_STRING;
compiler_globals->global_auto_globals_table = compiler_globals->auto_globals = (HashTable *) malloc(sizeof(HashTable)); compiler_globals->auto_globals = (HashTable *) malloc(sizeof(HashTable));
zend_u_hash_init_ex(compiler_globals->auto_globals, 8, NULL, NULL, 1, 0, 0); zend_u_hash_init_ex(compiler_globals->auto_globals, 8, NULL, NULL, 1, UG(unicode), 0);
zend_hash_copy(compiler_globals->auto_globals, global_auto_globals_table, NULL, NULL, sizeof(zend_auto_global) /* empty element */); zend_hash_copy(compiler_globals->auto_globals, global_auto_globals_table, NULL, NULL, sizeof(zend_auto_global) /* empty element */);
if (global_u_auto_globals_table) {
compiler_globals->global_u_auto_globals_table = (HashTable *) malloc(sizeof(HashTable));
zend_u_hash_init_ex(compiler_globals->global_u_auto_globals_table, 8, NULL, NULL, 1, 1, 0);
zend_hash_copy(compiler_globals->global_u_auto_globals_table, global_u_auto_globals_table, NULL, NULL, sizeof(zend_auto_global) /* empty element */);
} else {
compiler_globals->global_u_auto_globals_table = NULL;
}
compiler_globals->last_static_member = zend_hash_num_elements(compiler_globals->class_table); compiler_globals->last_static_member = zend_hash_num_elements(compiler_globals->class_table);
if (compiler_globals->last_static_member) { if (compiler_globals->last_static_member) {
compiler_globals->static_members = (HashTable**)calloc(compiler_globals->last_static_member, sizeof(HashTable*)); compiler_globals->static_members = (HashTable**)calloc(compiler_globals->last_static_member, sizeof(HashTable*));
@ -978,38 +828,17 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS
static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS_DC) static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS_DC)
{ {
if (compiler_globals->function_table != global_function_table && if (compiler_globals->function_table != GLOBAL_FUNCTION_TABLE) {
compiler_globals->function_table != global_u_function_table) { zend_hash_destroy(compiler_globals->function_table);
if (compiler_globals->global_function_table) { free(compiler_globals->function_table);
zend_hash_destroy(compiler_globals->global_function_table);
free(compiler_globals->global_function_table);
} }
if (compiler_globals->global_u_function_table) { if (compiler_globals->class_table != GLOBAL_CLASS_TABLE) {
zend_hash_destroy(compiler_globals->global_u_function_table); zend_hash_destroy(compiler_globals->class_table);
free(compiler_globals->global_u_function_table); free(compiler_globals->class_table);
}
}
if (compiler_globals->class_table != global_class_table &&
compiler_globals->class_table != global_u_class_table) {
if (compiler_globals->global_class_table) {
zend_hash_destroy(compiler_globals->global_class_table);
free(compiler_globals->global_class_table);
}
if (compiler_globals->global_u_class_table) {
zend_hash_destroy(compiler_globals->global_u_class_table);
free(compiler_globals->global_u_class_table);
}
}
if (compiler_globals->auto_globals != global_auto_globals_table &&
compiler_globals->auto_globals != global_u_auto_globals_table) {
if (compiler_globals->global_auto_globals_table) {
zend_hash_destroy(compiler_globals->global_auto_globals_table);
free(compiler_globals->global_auto_globals_table);
}
if (compiler_globals->global_u_auto_globals_table) {
zend_hash_destroy(compiler_globals->global_u_auto_globals_table);
free(compiler_globals->global_u_auto_globals_table);
} }
if (compiler_globals->auto_globals != GLOBAL_AUTO_GLOBALS_TABLE) {
zend_hash_destroy(compiler_globals->auto_globals);
free(compiler_globals->auto_globals);
} }
if (compiler_globals->static_members) { if (compiler_globals->static_members) {
free(compiler_globals->static_members); free(compiler_globals->static_members);
@ -1020,20 +849,8 @@ static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS
static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS_DC) static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS_DC)
{ {
zend_constant tmp_const;
zend_startup_constants(TSRMLS_C); zend_startup_constants(TSRMLS_C);
zend_copy_constants(EG(zend_constants), global_constants_table); zend_copy_constants(EG(zend_constants), GLOBAL_CONSTANTS_TABLE);
EG(global_constants_table) = EG(zend_constants);
if (global_u_constants_table) {
EG(global_u_constants_table) = (HashTable *) malloc(sizeof(HashTable));
zend_u_hash_init_ex(EG(global_u_constants_table), global_u_constants_table->nNumOfElements, NULL, ZEND_CONSTANT_DTOR, 1, 1, 0);
zend_hash_copy(EG(global_u_constants_table), global_u_constants_table, (copy_ctor_func_t) copy_u_zend_constant, &tmp_const, sizeof(zend_constant));
} else {
EG(global_u_constants_table) = NULL;
}
zend_init_rsrc_plist(TSRMLS_C); zend_init_rsrc_plist(TSRMLS_C);
EG(lambda_count)=0; EG(lambda_count)=0;
EG(user_error_handler) = NULL; EG(user_error_handler) = NULL;
@ -1051,16 +868,9 @@ static void executor_globals_dtor(zend_executor_globals *executor_globals TSRMLS
if (&executor_globals->persistent_list != global_persistent_list) { if (&executor_globals->persistent_list != global_persistent_list) {
zend_destroy_rsrc_list(&executor_globals->persistent_list TSRMLS_CC); zend_destroy_rsrc_list(&executor_globals->persistent_list TSRMLS_CC);
} }
if (executor_globals->global_constants_table != global_constants_table && if (executor_globals->zend_constants != GLOBAL_CONSTANTS_TABLE) {
executor_globals->global_u_constants_table != global_u_function_table) { zend_hash_destroy(executor_globals->zend_constants);
if (executor_globals->global_constants_table) { free(executor_globals->zend_constants);
zend_hash_destroy(executor_globals->global_constants_table);
free(executor_globals->global_constants_table);
}
if (executor_globals->global_u_constants_table) {
zend_hash_destroy(executor_globals->global_u_constants_table);
free(executor_globals->global_u_constants_table);
}
} }
} }
@ -1082,6 +892,7 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals_p TSRMLS_DC)
start_memory_manager(TSRMLS_C); start_memory_manager(TSRMLS_C);
} }
#if defined(__FreeBSD__) || defined(__DragonFly__) #if defined(__FreeBSD__) || defined(__DragonFly__)
/* FreeBSD and DragonFly floating point precision fix */ /* FreeBSD and DragonFly floating point precision fix */
#include <floatingpoint.h> #include <floatingpoint.h>
@ -1201,15 +1012,15 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
zend_version_info = strdup(ZEND_CORE_VERSION_INFO); zend_version_info = strdup(ZEND_CORE_VERSION_INFO);
zend_version_info_length = sizeof(ZEND_CORE_VERSION_INFO)-1; zend_version_info_length = sizeof(ZEND_CORE_VERSION_INFO)-1;
global_function_table = (HashTable *) malloc(sizeof(HashTable)); GLOBAL_FUNCTION_TABLE = (HashTable *) malloc(sizeof(HashTable));
global_class_table = (HashTable *) malloc(sizeof(HashTable)); GLOBAL_CLASS_TABLE = (HashTable *) malloc(sizeof(HashTable));
global_auto_globals_table = (HashTable *) malloc(sizeof(HashTable)); GLOBAL_AUTO_GLOBALS_TABLE = (HashTable *) malloc(sizeof(HashTable));
global_constants_table = (HashTable *) malloc(sizeof(HashTable)); GLOBAL_CONSTANTS_TABLE = (HashTable *) malloc(sizeof(HashTable));
zend_hash_init_ex(global_function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0); zend_hash_init_ex(GLOBAL_FUNCTION_TABLE, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0);
zend_hash_init_ex(global_class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0); zend_hash_init_ex(GLOBAL_CLASS_TABLE, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
zend_hash_init_ex(global_auto_globals_table, 8, NULL, (dtor_func_t) zend_auto_global_dtor, 1, 0); zend_hash_init_ex(GLOBAL_AUTO_GLOBALS_TABLE, 8, NULL, (dtor_func_t) zend_auto_global_dtor, 1, 0);
zend_hash_init_ex(global_constants_table, 20, NULL, ZEND_CONSTANT_DTOR, 1, 0); zend_hash_init_ex(GLOBAL_CONSTANTS_TABLE, 20, NULL, ZEND_CONSTANT_DTOR, 1, 0);
zend_hash_init_ex(&module_registry, 50, NULL, ZEND_MODULE_DTOR, 1, 0); zend_hash_init_ex(&module_registry, 50, NULL, ZEND_MODULE_DTOR, 1, 0);
zend_init_rsrc_list_dtors(); zend_init_rsrc_list_dtors();
@ -1235,22 +1046,16 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable)); compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable));
compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable)); compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
*compiler_globals->function_table = *global_function_table; *compiler_globals->function_table = *GLOBAL_FUNCTION_TABLE;
*compiler_globals->class_table = *global_class_table; *compiler_globals->class_table = *GLOBAL_CLASS_TABLE;
compiler_globals->auto_globals = global_auto_globals_table; compiler_globals->auto_globals = GLOBAL_AUTO_GLOBALS_TABLE;
zend_hash_destroy(executor_globals->zend_constants); zend_hash_destroy(executor_globals->zend_constants);
*executor_globals->zend_constants = *global_constants_table; *executor_globals->zend_constants = *GLOBAL_CONSTANTS_TABLE;
#else #else
unicode_globals_ctor(&unicode_globals TSRMLS_CC); unicode_globals_ctor(&unicode_globals TSRMLS_CC);
scanner_globals_ctor(&ini_scanner_globals TSRMLS_CC); scanner_globals_ctor(&ini_scanner_globals TSRMLS_CC);
scanner_globals_ctor(&language_scanner_globals TSRMLS_CC); scanner_globals_ctor(&language_scanner_globals TSRMLS_CC);
CG(function_table) = global_function_table;
CG(class_table) = global_class_table;
CG(auto_globals) = global_auto_globals_table;
EG(zend_constants) = global_constants_table;
zend_set_default_compile_time_values(TSRMLS_C); zend_set_default_compile_time_values(TSRMLS_C);
EG(user_error_handler) = NULL; EG(user_error_handler) = NULL;
EG(user_exception_handler) = NULL; EG(user_exception_handler) = NULL;
@ -1261,7 +1066,6 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
#ifndef ZTS #ifndef ZTS
zend_init_rsrc_plist(TSRMLS_C); zend_init_rsrc_plist(TSRMLS_C);
global_persistent_list = &EG(persistent_list);
#endif #endif
if (start_builtin_functions) { if (start_builtin_functions) {
@ -1290,44 +1094,34 @@ void zend_register_standard_ini_entries(TSRMLS_D)
*/ */
void zend_post_startup(TSRMLS_D) void zend_post_startup(TSRMLS_D)
{ {
UConverter *old_runtime_encoding_conv;
UErrorCode status = U_ZERO_ERROR;
zend_function tmp_func;
zend_class_entry *tmp_class;
zend_constant tmp_const;
#ifdef ZTS #ifdef ZTS
zend_compiler_globals *compiler_globals = ts_resource(compiler_globals_id); zend_compiler_globals *compiler_globals = ts_resource(compiler_globals_id);
zend_executor_globals *executor_globals = ts_resource(executor_globals_id); zend_executor_globals *executor_globals = ts_resource(executor_globals_id);
*global_function_table = *compiler_globals->function_table; *GLOBAL_FUNCTION_TABLE = *compiler_globals->function_table;
*global_class_table = *compiler_globals->class_table; *GLOBAL_CLASS_TABLE = *compiler_globals->class_table;
*global_constants_table = *executor_globals->zend_constants; *GLOBAL_CONSTANTS_TABLE = *executor_globals->zend_constants;
#endif #endif
/* Make copies of HashTables with UNICODE */ /* Make copies of HashTables with UNICODE */
if (UG(unicode)) {
UConverter *old_runtime_encoding_conv;
UErrorCode status = U_ZERO_ERROR;
old_runtime_encoding_conv = UG(runtime_encoding_conv); old_runtime_encoding_conv = UG(runtime_encoding_conv);
UG(runtime_encoding_conv) = ucnv_open("ASCII", &status); UG(runtime_encoding_conv) = ucnv_open("ASCII", &status);
global_u_function_table = (HashTable *) malloc(sizeof(HashTable)); zend_hash_to_unicode(GLOBAL_FUNCTION_TABLE, (apply_func_t)function_to_unicode TSRMLS_CC);
zend_u_hash_init_ex(global_u_function_table, global_function_table->nNumOfElements, NULL, ZEND_U_FUNCTION_DTOR, 1, 1, 0); GLOBAL_FUNCTION_TABLE->pDestructor = ZEND_U_FUNCTION_DTOR;
zend_hash_copy(global_u_function_table, global_function_table, (copy_ctor_func_t) function_to_unicode, &tmp_func, sizeof(zend_function)); zend_hash_to_unicode(GLOBAL_CLASS_TABLE, (apply_func_t)class_to_unicode TSRMLS_CC);
zend_hash_to_unicode(GLOBAL_AUTO_GLOBALS_TABLE, NULL TSRMLS_CC);
global_u_class_table = (HashTable *) malloc(sizeof(HashTable)); zend_hash_to_unicode(GLOBAL_CONSTANTS_TABLE, (apply_func_t)const_to_unicode TSRMLS_CC);
zend_u_hash_init_ex(global_u_class_table, global_class_table->nNumOfElements, NULL, ZEND_CLASS_DTOR, 1, 1, 0); GLOBAL_CONSTANTS_TABLE->pDestructor = ZEND_U_CONSTANT_DTOR;
zend_hash_copy(global_u_class_table, global_class_table, (copy_ctor_func_t) class_to_unicode, &tmp_class, sizeof(zend_class_entry *));
fix_classes(global_u_class_table);
global_u_auto_globals_table = (HashTable *) malloc(sizeof(HashTable));
zend_u_hash_init_ex(global_u_auto_globals_table, global_auto_globals_table->nNumOfElements, NULL, NULL, 1, 1, 0);
zend_hash_copy(global_u_auto_globals_table, global_auto_globals_table, NULL, NULL, sizeof(zend_auto_global));
global_u_constants_table = (HashTable *) malloc(sizeof(HashTable));
zend_u_hash_init_ex(global_u_constants_table, global_constants_table->nNumOfElements, NULL, ZEND_U_CONSTANT_DTOR, 1, 1, 0);
zend_hash_copy(global_u_constants_table, global_constants_table, (copy_ctor_func_t) const_to_unicode, &tmp_const, sizeof(zend_constant));
ucnv_close(UG(runtime_encoding_conv)); ucnv_close(UG(runtime_encoding_conv));
UG(runtime_encoding_conv) = old_runtime_encoding_conv; UG(runtime_encoding_conv) = old_runtime_encoding_conv;
}
#ifdef ZTS #ifdef ZTS
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC); zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
@ -1347,54 +1141,29 @@ void zend_shutdown(TSRMLS_D)
#ifdef ZEND_WIN32 #ifdef ZEND_WIN32
zend_shutdown_timeout_thread(); zend_shutdown_timeout_thread();
#endif #endif
if (global_persistent_list) { zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
zend_destroy_rsrc_list(global_persistent_list TSRMLS_CC);
}
zend_hash_graceful_reverse_destroy(&module_registry); zend_hash_graceful_reverse_destroy(&module_registry);
zend_hash_destroy(global_function_table); zend_hash_destroy(GLOBAL_FUNCTION_TABLE);
zend_hash_destroy(global_class_table); zend_hash_destroy(GLOBAL_CLASS_TABLE);
if (global_u_function_table) {
zend_hash_destroy(global_u_function_table);
}
if (global_u_class_table) {
zend_hash_destroy(global_u_class_table);
}
zend_hash_destroy(global_auto_globals_table); zend_hash_destroy(GLOBAL_AUTO_GLOBALS_TABLE);
free(global_auto_globals_table); free(GLOBAL_AUTO_GLOBALS_TABLE);
if (global_u_auto_globals_table) {
zend_hash_destroy(global_u_auto_globals_table);
free(global_u_auto_globals_table);
}
zend_shutdown_extensions(TSRMLS_C); zend_shutdown_extensions(TSRMLS_C);
free(zend_version_info); free(zend_version_info);
zend_hash_destroy(global_constants_table); free(GLOBAL_FUNCTION_TABLE);
free(global_constants_table); free(GLOBAL_CLASS_TABLE);
if (global_u_constants_table) {
zend_hash_destroy(global_u_constants_table); zend_hash_destroy(GLOBAL_CONSTANTS_TABLE);
free(global_u_constants_table); free(GLOBAL_CONSTANTS_TABLE);
}
free(global_function_table);
free(global_class_table);
if (global_u_function_table) {
free(global_u_function_table);
}
if (global_u_class_table) {
free(global_u_class_table);
}
#ifdef ZTS #ifdef ZTS
global_function_table = NULL; GLOBAL_FUNCTION_TABLE = NULL;
global_u_function_table = NULL; GLOBAL_CLASS_TABLE = NULL;
global_class_table = NULL; GLOBAL_AUTO_GLOBALS_TABLE = NULL;
global_u_class_table = NULL; GLOBAL_CONSTANTS_TABLE = NULL;
global_auto_globals_table = NULL;
global_u_auto_globals_table = NULL;
global_constants_table = NULL;
global_u_constants_table = NULL;
#else #else
unicode_globals_dtor(&unicode_globals TSRMLS_CC); unicode_globals_dtor(&unicode_globals TSRMLS_CC);
#endif #endif
@ -1489,19 +1258,7 @@ static void shutdown_unicode_request_globals(TSRMLS_D)
void zend_activate(TSRMLS_D) void zend_activate(TSRMLS_D)
{ {
#ifdef ZTS
CG(function_table) = UG(unicode)?CG(global_u_function_table):CG(global_function_table);
CG(class_table) = UG(unicode)?CG(global_u_class_table):CG(global_class_table);
CG(auto_globals) = UG(unicode)?CG(global_u_auto_globals_table):CG(global_auto_globals_table);
EG(zend_constants) = UG(unicode)?EG(global_u_constants_table):EG(global_constants_table);
#else
CG(function_table) = UG(unicode)?global_u_function_table:global_function_table;
CG(class_table) = UG(unicode)?global_u_class_table:global_class_table;
CG(auto_globals) = UG(unicode)?global_u_auto_globals_table:global_auto_globals_table;
EG(zend_constants) = UG(unicode)?global_u_constants_table:global_constants_table;
#endif
init_unicode_request_globals(TSRMLS_C); init_unicode_request_globals(TSRMLS_C);
init_unicode_strings(); init_unicode_strings();
init_compiler(TSRMLS_C); init_compiler(TSRMLS_C);
init_executor(TSRMLS_C); init_executor(TSRMLS_C);

View file

@ -373,8 +373,6 @@ struct _zend_class_entry {
char *doc_comment; char *doc_comment;
zend_uint doc_comment_len; zend_uint doc_comment_len;
zend_class_entry *u_twin;
struct _zend_module_entry *module; struct _zend_module_entry *module;
}; };
@ -541,7 +539,7 @@ ZEND_API void zend_error(int type, const char *format, ...);
void zenderror(char *error); void zenderror(char *error);
/* The following #define is used for code duality in PHP for Engine 1 & 2 */ /* The following #define is used for code duality in PHP for Engine 1 & 2 */
#define ZEND_STANDARD_CLASS_DEF_PTR U_CLASS_ENTRY(zend_standard_class_def) #define ZEND_STANDARD_CLASS_DEF_PTR zend_standard_class_def
extern ZEND_API zend_class_entry *zend_standard_class_def; extern ZEND_API zend_class_entry *zend_standard_class_def;
extern ZEND_API zend_utility_values zend_uv; extern ZEND_API zend_utility_values zend_uv;
extern ZEND_API zval zval_used_for_init; extern ZEND_API zval zval_used_for_init;

View file

@ -1164,7 +1164,7 @@ ZEND_API int _object_init_ex(zval *arg, zend_class_entry *class_type ZEND_FILE_L
ZEND_API int _object_init(zval *arg ZEND_FILE_LINE_DC TSRMLS_DC) ZEND_API int _object_init(zval *arg ZEND_FILE_LINE_DC TSRMLS_DC)
{ {
return _object_init_ex(arg, U_CLASS_ENTRY(zend_standard_class_def) ZEND_FILE_LINE_RELAY_CC TSRMLS_CC); return _object_init_ex(arg, zend_standard_class_def ZEND_FILE_LINE_RELAY_CC TSRMLS_CC);
} }

View file

@ -114,8 +114,6 @@ typedef struct _zend_function_entry {
#endif #endif
#define U_CLASS_ENTRY(ce) ((UG(unicode)&&ce)?ce->u_twin:ce)
#define INIT_CLASS_ENTRY(class_container, class_name, functions) INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, NULL, NULL, NULL) #define INIT_CLASS_ENTRY(class_container, class_name, functions) INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, NULL, NULL, NULL)
#define INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \ #define INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \
@ -145,7 +143,6 @@ typedef struct _zend_function_entry {
class_container.interfaces = NULL; \ class_container.interfaces = NULL; \
class_container.get_iterator = NULL; \ class_container.get_iterator = NULL; \
class_container.iterator_funcs.funcs = NULL; \ class_container.iterator_funcs.funcs = NULL; \
class_container.u_twin = NULL; \
class_container.module = NULL; \ class_container.module = NULL; \
} }

View file

@ -179,7 +179,6 @@ struct _zend_op_array {
zend_arg_info *arg_info; zend_arg_info *arg_info;
zend_bool pass_rest_by_reference; zend_bool pass_rest_by_reference;
unsigned char return_reference; unsigned char return_reference;
union _zend_function *u_twin;
/* END of common elements */ /* END of common elements */
zend_uint *refcount; zend_uint *refcount;
@ -234,7 +233,6 @@ typedef struct _zend_internal_function {
zend_arg_info *arg_info; zend_arg_info *arg_info;
zend_bool pass_rest_by_reference; zend_bool pass_rest_by_reference;
unsigned char return_reference; unsigned char return_reference;
union _zend_function *u_twin;
/* END of common elements */ /* END of common elements */
void (*handler)(INTERNAL_FUNCTION_PARAMETERS); void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
@ -257,7 +255,6 @@ typedef union _zend_function {
zend_arg_info *arg_info; zend_arg_info *arg_info;
zend_bool pass_rest_by_reference; zend_bool pass_rest_by_reference;
unsigned char return_reference; unsigned char return_reference;
union _zend_function *u_twin;
} common; } common;
zend_op_array op_array; zend_op_array op_array;

View file

@ -93,9 +93,9 @@ static zend_object_value zend_default_exception_new_ex(zend_class_entry *class_t
trace->refcount = 0; trace->refcount = 0;
zend_fetch_debug_backtrace(trace, skip_top_traces, 0 TSRMLS_CC); zend_fetch_debug_backtrace(trace, skip_top_traces, 0 TSRMLS_CC);
zend_update_property_rt_string(U_CLASS_ENTRY(default_exception_ce), &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC); zend_update_property_rt_string(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_long(default_exception_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC);
zend_update_property(U_CLASS_ENTRY(default_exception_ce), &obj, "trace", sizeof("trace")-1, trace TSRMLS_CC); zend_update_property(default_exception_ce, &obj, "trace", sizeof("trace")-1, trace TSRMLS_CC);
return obj.value.obj; return obj.value.obj;
} }
@ -139,22 +139,22 @@ ZEND_METHOD(exception, __construct)
if (message) { if (message) {
if (message_type == IS_UNICODE) { if (message_type == IS_UNICODE) {
zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC); zend_update_property_unicodel(default_exception_ce, object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);
} else if (UG(unicode)) { } else if (UG(unicode)) {
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
UChar *u_str; UChar *u_str;
int32_t u_len; int32_t u_len;
zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, message, message_len, &status); zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, message, message_len, &status);
zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, u_str, u_len TSRMLS_CC); zend_update_property_unicodel(default_exception_ce, object, "message", sizeof("message")-1, u_str, u_len TSRMLS_CC);
efree(u_str); efree(u_str);
} else { } else {
zend_update_property_stringl(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC); zend_update_property_stringl(default_exception_ce, object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);
} }
} }
if (code) { if (code) {
zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), object, "code", sizeof("code")-1, code TSRMLS_CC); zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC);
} }
} }
/* }}} */ /* }}} */
@ -178,36 +178,36 @@ ZEND_METHOD(error_exception, __construct)
if (message) { if (message) {
if (message_type == IS_UNICODE) { if (message_type == IS_UNICODE) {
zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC); zend_update_property_unicodel(default_exception_ce, object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);
} else if (UG(unicode)) { } else if (UG(unicode)) {
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
UChar *u_str; UChar *u_str;
int32_t u_len; int32_t u_len;
zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, message, message_len, &status); zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, message, message_len, &status);
zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, u_str, u_len TSRMLS_CC); zend_update_property_unicodel(default_exception_ce, object, "message", sizeof("message")-1, u_str, u_len TSRMLS_CC);
efree(u_str); efree(u_str);
} else { } else {
zend_update_property_stringl(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC); zend_update_property_stringl(default_exception_ce, object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);
} }
} }
if (code) { if (code) {
zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), object, "code", sizeof("code")-1, code TSRMLS_CC); zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC);
} }
zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), object, "severity", sizeof("severity")-1, severity TSRMLS_CC); zend_update_property_long(default_exception_ce, object, "severity", sizeof("severity")-1, severity TSRMLS_CC);
if (argc >= 4) { if (argc >= 4) {
if (file_type == IS_UNICODE) { if (file_type == IS_UNICODE) {
zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "file", sizeof("file")-1, filename, filename_len TSRMLS_CC); zend_update_property_unicodel(default_exception_ce, object, "file", sizeof("file")-1, filename, filename_len TSRMLS_CC);
} else { } else {
zend_update_property_stringl(U_CLASS_ENTRY(default_exception_ce), object, "file", sizeof("file")-1, filename, filename_len TSRMLS_CC); zend_update_property_stringl(default_exception_ce, object, "file", sizeof("file")-1, filename, filename_len TSRMLS_CC);
} }
if (argc < 5) { if (argc < 5) {
lineno = 0; /* invalidate lineno */ lineno = 0; /* invalidate lineno */
} }
zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), object, "line", sizeof("line")-1, lineno TSRMLS_CC); zend_update_property_long(default_exception_ce, object, "line", sizeof("line")-1, lineno TSRMLS_CC);
} }
} }
/* }}} */ /* }}} */
@ -221,7 +221,7 @@ static void _default_exception_get_entry(zval *object, char *name, int name_len,
{ {
zval *value; zval *value;
value = zend_read_property(U_CLASS_ENTRY(default_exception_ce), object, name, name_len, 0 TSRMLS_CC); value = zend_read_property(default_exception_ce, object, name, name_len, 0 TSRMLS_CC);
*return_value = *value; *return_value = *value;
zval_copy_ctor(return_value); zval_copy_ctor(return_value);
@ -524,7 +524,7 @@ ZEND_METHOD(exception, getTraceAsString)
char *res = estrdup(""), **str = &res, *s_tmp; char *res = estrdup(""), **str = &res, *s_tmp;
int res_len = 0, *len = &res_len, num = 0; int res_len = 0, *len = &res_len, num = 0;
trace = zend_read_property(U_CLASS_ENTRY(default_exception_ce), getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC); trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
zend_hash_apply_with_arguments(Z_ARRVAL_P(trace), (apply_func_args_t)_build_trace_string, 3, str, len, &num); 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); s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 7 + 1);
@ -596,7 +596,7 @@ ZEND_METHOD(exception, __toString)
/* We store the result in the private property string so we can access /* We store the result in the private property string so we can access
* the result in uncaught exception handlers without memleaks. */ * the result in uncaught exception handlers without memleaks. */
zend_update_property_string(U_CLASS_ENTRY(default_exception_ce), getThis(), "string", sizeof("string")-1, str TSRMLS_CC); zend_update_property_string(default_exception_ce, getThis(), "string", sizeof("string")-1, str TSRMLS_CC);
if (trace) { if (trace) {
zval_ptr_dtor(&trace); zval_ptr_dtor(&trace);
@ -678,12 +678,12 @@ void zend_register_default_exception(TSRMLS_D)
ZEND_API zend_class_entry *zend_exception_get_default(TSRMLS_D) ZEND_API zend_class_entry *zend_exception_get_default(TSRMLS_D)
{ {
return U_CLASS_ENTRY(default_exception_ce); return default_exception_ce;
} }
ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D) ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D)
{ {
return U_CLASS_ENTRY(error_exception_ce); return error_exception_ce;
} }
@ -693,21 +693,21 @@ ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, char *messa
MAKE_STD_ZVAL(ex); MAKE_STD_ZVAL(ex);
if (exception_ce) { if (exception_ce) {
if (!instanceof_function(exception_ce, U_CLASS_ENTRY(default_exception_ce) TSRMLS_CC)) { if (!instanceof_function(exception_ce, default_exception_ce TSRMLS_CC)) {
zend_error(E_NOTICE, "Exceptions must be derived from the Exception base class"); zend_error(E_NOTICE, "Exceptions must be derived from the Exception base class");
exception_ce = U_CLASS_ENTRY(default_exception_ce); exception_ce = default_exception_ce;
} }
} else { } else {
exception_ce = U_CLASS_ENTRY(default_exception_ce); exception_ce = default_exception_ce;
} }
object_init_ex(ex, exception_ce); object_init_ex(ex, exception_ce);
if (message) { if (message) {
zend_update_property_rt_string(U_CLASS_ENTRY(default_exception_ce), ex, "message", sizeof("message")-1, message TSRMLS_CC); zend_update_property_rt_string(default_exception_ce, ex, "message", sizeof("message")-1, message TSRMLS_CC);
} }
if (code) { if (code) {
zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), ex, "code", sizeof("code")-1, code TSRMLS_CC); zend_update_property_long(default_exception_ce, ex, "code", sizeof("code")-1, code TSRMLS_CC);
} }
zend_throw_exception_internal(ex TSRMLS_CC); zend_throw_exception_internal(ex TSRMLS_CC);
@ -733,7 +733,7 @@ ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long cod
ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, char *message, long code, int severity TSRMLS_DC) 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); zval *ex = zend_throw_exception(exception_ce, message, code TSRMLS_CC);
zend_update_property_long(U_CLASS_ENTRY(default_exception_ce), ex, "severity", sizeof("severity")-1, severity TSRMLS_CC); zend_update_property_long(default_exception_ce, ex, "severity", sizeof("severity")-1, severity TSRMLS_CC);
return ex; return ex;
} }
@ -750,7 +750,7 @@ static void zend_error_va(int type, const char *file, uint lineno, const char *f
ZEND_API void zend_exception_error(zval *exception TSRMLS_DC) ZEND_API void zend_exception_error(zval *exception TSRMLS_DC)
{ {
zend_class_entry *ce_exception = Z_OBJCE_P(exception); zend_class_entry *ce_exception = Z_OBJCE_P(exception);
if (instanceof_function(ce_exception, U_CLASS_ENTRY(default_exception_ce) TSRMLS_CC)) { if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {
zval *str, *file, *line; zval *str, *file, *line;
EG(exception) = NULL; EG(exception) = NULL;
@ -760,16 +760,16 @@ ZEND_API void zend_exception_error(zval *exception TSRMLS_DC)
if (Z_TYPE_P(str) != IS_STRING) { if (Z_TYPE_P(str) != IS_STRING) {
zend_error(E_WARNING, "%v::__toString() must return a string", ce_exception->name); zend_error(E_WARNING, "%v::__toString() must return a string", ce_exception->name);
} else { } else {
zend_update_property_string(U_CLASS_ENTRY(default_exception_ce), exception, "string", sizeof("string")-1, EG(exception) ? ce_exception->name : Z_STRVAL_P(str) TSRMLS_CC); zend_update_property_string(default_exception_ce, exception, "string", sizeof("string")-1, EG(exception) ? ce_exception->name : Z_STRVAL_P(str) TSRMLS_CC);
} }
} }
zval_ptr_dtor(&str); zval_ptr_dtor(&str);
if (EG(exception)) { if (EG(exception)) {
/* do the best we can to inform about the inner exception */ /* do the best we can to inform about the inner exception */
if (instanceof_function(ce_exception, U_CLASS_ENTRY(default_exception_ce) TSRMLS_CC)) { if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {
file = zend_read_property(U_CLASS_ENTRY(default_exception_ce), EG(exception), "file", sizeof("file")-1, 1 TSRMLS_CC); file = zend_read_property(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); line = zend_read_property(default_exception_ce, EG(exception), "line", sizeof("line")-1, 1 TSRMLS_CC);
} else { } else {
file = NULL; file = NULL;
line = NULL; line = NULL;
@ -777,9 +777,9 @@ ZEND_API void zend_exception_error(zval *exception TSRMLS_DC)
zend_error_va(E_WARNING, file ? Z_STRVAL_P(file) : NULL, line ? Z_LVAL_P(line) : 0, "Uncaught %v in exception handling during call to %v::__tostring()", Z_OBJCE_P(EG(exception))->name, ce_exception->name); zend_error_va(E_WARNING, file ? Z_STRVAL_P(file) : NULL, line ? Z_LVAL_P(line) : 0, "Uncaught %v in exception handling during call to %v::__tostring()", Z_OBJCE_P(EG(exception))->name, ce_exception->name);
} }
str = zend_read_property(U_CLASS_ENTRY(default_exception_ce), exception, "string", sizeof("string")-1, 1 TSRMLS_CC); str = zend_read_property(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); file = zend_read_property(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); line = zend_read_property(default_exception_ce, exception, "line", sizeof("line")-1, 1 TSRMLS_CC);
if (Z_TYPE_P(file) == IS_UNICODE) { if (Z_TYPE_P(file) == IS_UNICODE) {
zval copy; zval copy;
@ -806,7 +806,7 @@ ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC)
exception_ce = Z_OBJCE_P(exception); exception_ce = Z_OBJCE_P(exception);
if (!exception_ce || !instanceof_function(exception_ce, U_CLASS_ENTRY(default_exception_ce) TSRMLS_CC)) { if (!exception_ce || !instanceof_function(exception_ce, default_exception_ce TSRMLS_CC)) {
zend_error(E_ERROR, "Exceptions must be valid objects derived from the Exception base class"); zend_error(E_ERROR, "Exceptions must be valid objects derived from the Exception base class");
} }
zend_throw_exception_internal(exception TSRMLS_CC); zend_throw_exception_internal(exception TSRMLS_CC);

View file

@ -137,13 +137,6 @@ struct _zend_compiler_globals {
char *script_encoding; char *script_encoding;
#ifdef ZTS #ifdef ZTS
HashTable *global_function_table;
HashTable *global_class_table;
HashTable *global_auto_globals_table;
HashTable *global_u_function_table;
HashTable *global_u_class_table;
HashTable *global_u_auto_globals_table;
HashTable **static_members; HashTable **static_members;
int last_static_member; int last_static_member;
#endif #endif
@ -236,11 +229,6 @@ struct _zend_executor_globals {
zend_property_info std_property_info; zend_property_info std_property_info;
#ifdef ZTS
HashTable *global_constants_table;
HashTable *global_u_constants_table;
#endif
void *reserved[ZEND_MAX_RESERVED_RESOURCES]; void *reserved[ZEND_MAX_RESERVED_RESOURCES];
}; };

View file

@ -1781,6 +1781,57 @@ void zend_hash_display(HashTable *ht)
p = p->pListLast; p = p->pListLast;
} }
} }
ZEND_API void zend_hash_to_unicode(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
{
Bucket **p;
uint nIndex;
IS_CONSISTENT(ht);
if (ht->unicode) {
return;
}
ht->unicode = 1;
memset(ht->arBuckets, 0, ht->nTableSize * sizeof(Bucket *));
p = &ht->pListHead;
while ((*p) != NULL) {
if ((*p)->key.type == IS_STRING) {
UErrorCode status = U_ZERO_ERROR;
UChar *u = NULL;
int32_t u_len;
Bucket *q;
zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u, &u_len, (char*)(*p)->key.u.string, (*p)->nKeyLength-1, &status);
q = (Bucket *) pemalloc(sizeof(Bucket)-sizeof(q->key.u)+((u_len+1)*2), ht->persistent);
memcpy(q, *p, sizeof(Bucket)-sizeof(q->key.u));
memcpy(q->key.u.unicode, u, (u_len+1)*2);
q->key.type = IS_UNICODE;
q->nKeyLength = u_len+1;
q->h = zend_u_inline_hash_func(IS_UNICODE, (void*)q->key.u.unicode, q->nKeyLength);
if ((*p)->pData == &(*p)->pDataPtr) {
q->pData = &q->pDataPtr;
}
efree(u);
pefree(*p, ht->persistent);
*p = q;
if (q->pListNext) {
q->pListNext->pListLast = q;
} else {
ht->pListTail = q;
}
}
nIndex = (*p)->h & ht->nTableMask;
CONNECT_TO_BUCKET_DLLIST(*p, ht->arBuckets[nIndex]);
ht->arBuckets[nIndex] = *p;
if (apply_func) {
apply_func((*p)->pData TSRMLS_CC);
}
p = &(*p)->pListNext;
}
}
#endif #endif
/* /*

View file

@ -175,6 +175,7 @@ ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t ap
*/ */
ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC); ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC);
ZEND_API void zend_hash_to_unicode(HashTable *ht, apply_func_t apply_func TSRMLS_DC);
/* Deletes */ /* Deletes */
ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag); ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag);

View file

@ -193,6 +193,7 @@ END_EXTERN_C()
typedef void (*zend_ini_parser_cb_t)(zval *arg1, zval *arg2, int callback_type, void *arg); typedef void (*zend_ini_parser_cb_t)(zval *arg1, zval *arg2, int callback_type, void *arg);
BEGIN_EXTERN_C() BEGIN_EXTERN_C()
ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg); ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg);
ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg);
END_EXTERN_C() END_EXTERN_C()
#define ZEND_INI_PARSER_ENTRY 1 #define ZEND_INI_PARSER_ENTRY 1

View file

@ -157,10 +157,14 @@ static void ini_error(char *str)
TSRMLS_FETCH(); TSRMLS_FETCH();
currently_parsed_filename = zend_ini_scanner_get_filename(TSRMLS_C); currently_parsed_filename = zend_ini_scanner_get_filename(TSRMLS_C);
if (currently_parsed_filename) {
error_buf_len = 128+strlen(currently_parsed_filename); /* should be more than enough */ error_buf_len = 128+strlen(currently_parsed_filename); /* should be more than enough */
error_buf = (char *) emalloc(error_buf_len); error_buf = (char *) emalloc(error_buf_len);
sprintf(error_buf, "Error parsing %s on line %d\n", currently_parsed_filename, zend_ini_scanner_get_lineno(TSRMLS_C)); sprintf(error_buf, "Error parsing %s on line %d\n", currently_parsed_filename, zend_ini_scanner_get_lineno(TSRMLS_C));
} else {
error_buf = estrdup("Invalid configuration directive\n");
}
if (CG(ini_parser_unbuffered_errors)) { if (CG(ini_parser_unbuffered_errors)) {
#ifdef PHP_WIN32 #ifdef PHP_WIN32
@ -202,6 +206,30 @@ ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_erro
} }
ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg)
{
int len;
zend_ini_parser_param ini_parser_param;
TSRMLS_FETCH();
ini_parser_param.ini_parser_cb = ini_parser_cb;
ini_parser_param.arg = arg;
CG(ini_parser_param) = &ini_parser_param;
if (zend_ini_prepare_string_for_scanning(str TSRMLS_CC)==FAILURE) {
return FAILURE;
}
CG(ini_parser_unbuffered_errors) = unbuffered_errors;
if (ini_parse(TSRMLS_C)) {
return SUCCESS;
} else {
return FAILURE;
}
}
%} %}
%pure_parser %pure_parser

View file

@ -26,6 +26,7 @@ BEGIN_EXTERN_C()
int zend_ini_scanner_get_lineno(TSRMLS_D); int zend_ini_scanner_get_lineno(TSRMLS_D);
char *zend_ini_scanner_get_filename(TSRMLS_D); char *zend_ini_scanner_get_filename(TSRMLS_D);
int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC); int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC);
int zend_ini_prepare_string_for_scanning(char *str TSRMLS_DC);
void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC); void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC);
int ini_lex(zval *ini_lval TSRMLS_DC); int ini_lex(zval *ini_lval TSRMLS_DC);
END_EXTERN_C() END_EXTERN_C()

View file

@ -87,6 +87,16 @@ int zend_ini_open_file_for_scanning(zend_file_handle *fh TSRMLS_DC)
} }
int zend_ini_prepare_string_for_scanning(char *str TSRMLS_DC)
{
int len = strlen(str);
yyin = NULL;
yy_scan_buffer(str, len + 2 TSRMLS_CC);
ini_filename = NULL;
return SUCCESS;
}
void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC) void zend_ini_close_file(zend_file_handle *fh TSRMLS_DC)
{ {
zend_stream_close(fh); zend_stream_close(fh);

View file

@ -325,11 +325,11 @@ static int zend_implement_traversable(zend_class_entry *interface, zend_class_en
return SUCCESS; return SUCCESS;
} }
for (i = 0; i < class_type->num_interfaces; i++) { for (i = 0; i < class_type->num_interfaces; i++) {
if (class_type->interfaces[i] == U_CLASS_ENTRY(zend_ce_aggregate) || class_type->interfaces[i] == U_CLASS_ENTRY(zend_ce_iterator)) { if (class_type->interfaces[i] == zend_ce_aggregate || class_type->interfaces[i] == zend_ce_iterator) {
return SUCCESS; return SUCCESS;
} }
} }
zend_error(E_CORE_ERROR, "Class %v must implement interface %s as part of either %s or %s", zend_error(E_CORE_ERROR, "Class %v must implement interface %v as part of either %v or %v",
class_type->name, class_type->name,
zend_ce_traversable->name, zend_ce_traversable->name,
zend_ce_iterator->name, zend_ce_iterator->name,
@ -351,10 +351,10 @@ static int zend_implement_aggregate(zend_class_entry *interface, zend_class_entr
/* c-level get_iterator cannot be changed (exception being only Traversable is implmented) */ /* c-level get_iterator cannot be changed (exception being only Traversable is implmented) */
if (class_type->num_interfaces) { if (class_type->num_interfaces) {
for (i = 0; i < class_type->num_interfaces; i++) { for (i = 0; i < class_type->num_interfaces; i++) {
if (class_type->interfaces[i] == U_CLASS_ENTRY(zend_ce_iterator)) { if (class_type->interfaces[i] == zend_ce_iterator) {
return FAILURE; return FAILURE;
} }
if (class_type->interfaces[i] == U_CLASS_ENTRY(zend_ce_traversable)) { if (class_type->interfaces[i] == zend_ce_traversable) {
t = i; t = i;
} }
} }

View file

@ -436,7 +436,7 @@ zval *zend_std_read_dimension(zval *object, zval *offset, int type TSRMLS_DC)
zend_class_entry *ce = Z_OBJCE_P(object); zend_class_entry *ce = Z_OBJCE_P(object);
zval *retval; zval *retval;
if (instanceof_function_ex(ce, U_CLASS_ENTRY(zend_ce_arrayaccess), 1 TSRMLS_CC)) { if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC)) {
if(offset == NULL) { if(offset == NULL) {
/* [] construct */ /* [] construct */
ALLOC_INIT_ZVAL(offset); ALLOC_INIT_ZVAL(offset);
@ -469,7 +469,7 @@ static void zend_std_write_dimension(zval *object, zval *offset, zval *value TSR
{ {
zend_class_entry *ce = Z_OBJCE_P(object); zend_class_entry *ce = Z_OBJCE_P(object);
if (instanceof_function_ex(ce, U_CLASS_ENTRY(zend_ce_arrayaccess), 1 TSRMLS_CC)) { if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC)) {
if (!offset) { if (!offset) {
ALLOC_INIT_ZVAL(offset); ALLOC_INIT_ZVAL(offset);
} else { } else {
@ -489,7 +489,7 @@ static int zend_std_has_dimension(zval *object, zval *offset, int check_empty TS
zval *retval; zval *retval;
int result; int result;
if (instanceof_function_ex(ce, U_CLASS_ENTRY(zend_ce_arrayaccess), 1 TSRMLS_CC)) { if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC)) {
SEPARATE_ARG_IF_REF(offset); SEPARATE_ARG_IF_REF(offset);
zend_call_method_with_1_params(&object, ce, NULL, "offsetexists", &retval, offset); zend_call_method_with_1_params(&object, ce, NULL, "offsetexists", &retval, offset);
if (retval) { if (retval) {
@ -603,7 +603,7 @@ static void zend_std_unset_dimension(zval *object, zval *offset TSRMLS_DC)
{ {
zend_class_entry *ce = Z_OBJCE_P(object); zend_class_entry *ce = Z_OBJCE_P(object);
if (instanceof_function_ex(ce, U_CLASS_ENTRY(zend_ce_arrayaccess), 1 TSRMLS_CC)) { if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC)) {
SEPARATE_ARG_IF_REF(offset); SEPARATE_ARG_IF_REF(offset);
zend_call_method_with_1_params(&object, ce, NULL, "offsetunset", NULL, offset); zend_call_method_with_1_params(&object, ce, NULL, "offsetunset", NULL, offset);
zval_ptr_dtor(&offset); zval_ptr_dtor(&offset);

View file

@ -838,7 +838,7 @@ ZEND_API void convert_to_object(zval *op)
switch (op->type) { switch (op->type) {
case IS_ARRAY: case IS_ARRAY:
{ {
object_and_properties_init(op, U_CLASS_ENTRY(zend_standard_class_def), op->value.ht); object_and_properties_init(op, zend_standard_class_def, op->value.ht);
return; return;
break; break;
} }

View file

@ -36,7 +36,7 @@ void php_com_throw_exception(HRESULT code, char *message TSRMLS_DC)
message = php_win_err(code); message = php_win_err(code);
free_msg = 1; free_msg = 1;
} }
zend_throw_exception(U_CLASS_ENTRY(php_com_exception_class_entry), message, (long)code TSRMLS_CC); zend_throw_exception(php_com_exception_class_entry, message, (long)code TSRMLS_CC);
if (free_msg) { if (free_msg) {
LocalFree(message); LocalFree(message);
} }

View file

@ -54,8 +54,8 @@ PHP_METHOD(domattr, __construct)
char *name, *value = NULL; char *name, *value = NULL;
int name_len, value_len, name_valid; int name_len, value_len, name_valid;
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(dom_domexception_class_entry) TSRMLS_CC); php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, U_CLASS_ENTRY(dom_attr_class_entry), &name, &name_len, &value, &value_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, dom_attr_class_entry, &name, &name_len, &value, &value_len) == FAILURE) {
php_std_error_handling(); php_std_error_handling();
return; return;
} }
@ -263,7 +263,7 @@ PHP_FUNCTION(dom_attr_is_id)
dom_object *intern; dom_object *intern;
xmlAttrPtr attrp; xmlAttrPtr attrp;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_attr_class_entry)) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_attr_class_entry) == FAILURE) {
return; return;
} }

View file

@ -50,8 +50,8 @@ PHP_METHOD(domcdatasection, __construct)
char *value = NULL; char *value = NULL;
int value_len; int value_len;
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(dom_domexception_class_entry) TSRMLS_CC); php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_cdatasection_class_entry), &value, &value_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_cdatasection_class_entry, &value, &value_len) == FAILURE) {
php_std_error_handling(); php_std_error_handling();
return; return;
} }

View file

@ -154,7 +154,7 @@ PHP_FUNCTION(dom_characterdata_substring_data)
int length; int length;
dom_object *intern; dom_object *intern;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &id, U_CLASS_ENTRY(dom_characterdata_class_entry), &offset, &count) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &id, dom_characterdata_class_entry, &offset, &count) == FAILURE) {
return; return;
} }
@ -202,7 +202,7 @@ PHP_FUNCTION(dom_characterdata_append_data)
char *arg; char *arg;
int arg_len; int arg_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_characterdata_class_entry), &arg, &arg_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_characterdata_class_entry, &arg, &arg_len) == FAILURE) {
return; return;
} }
@ -229,7 +229,7 @@ PHP_FUNCTION(dom_characterdata_insert_data)
int length, arg_len; int length, arg_len;
dom_object *intern; dom_object *intern;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &id, U_CLASS_ENTRY(dom_characterdata_class_entry), &offset, &arg, &arg_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &id, dom_characterdata_class_entry, &offset, &arg, &arg_len) == FAILURE) {
return; return;
} }
@ -277,7 +277,7 @@ PHP_FUNCTION(dom_characterdata_delete_data)
int length; int length;
dom_object *intern; dom_object *intern;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &id, U_CLASS_ENTRY(dom_characterdata_class_entry), &offset, &count) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &id, dom_characterdata_class_entry, &offset, &count) == FAILURE) {
return; return;
} }
@ -334,7 +334,7 @@ PHP_FUNCTION(dom_characterdata_replace_data)
int length, arg_len; int length, arg_len;
dom_object *intern; dom_object *intern;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olls", &id, U_CLASS_ENTRY(dom_characterdata_class_entry), &offset, &count, &arg, &arg_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olls", &id, dom_characterdata_class_entry, &offset, &count, &arg, &arg_len) == FAILURE) {
return; return;
} }

View file

@ -50,8 +50,8 @@ PHP_METHOD(domcomment, __construct)
char *value = NULL; char *value = NULL;
int value_len; int value_len;
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(dom_domexception_class_entry) TSRMLS_CC); php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|s", &id, U_CLASS_ENTRY(dom_comment_class_entry), &value, &value_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|s", &id, dom_comment_class_entry, &value, &value_len) == FAILURE) {
php_std_error_handling(); php_std_error_handling();
return; return;
} }

View file

@ -774,7 +774,7 @@ PHP_FUNCTION(dom_document_create_element)
int ret, name_len, value_len; int ret, name_len, value_len;
char *name, *value = NULL; char *name, *value = NULL;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, U_CLASS_ENTRY(dom_document_class_entry), &name, &name_len, &value, &value_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, dom_document_class_entry, &name, &name_len, &value, &value_len) == FAILURE) {
return; return;
} }
@ -807,7 +807,7 @@ PHP_FUNCTION(dom_document_create_document_fragment)
dom_object *intern; dom_object *intern;
int ret; int ret;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_document_class_entry)) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_document_class_entry) == FAILURE) {
return; return;
} }
@ -836,7 +836,7 @@ PHP_FUNCTION(dom_document_create_text_node)
dom_object *intern; dom_object *intern;
char *value; char *value;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &value, &value_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &value, &value_len) == FAILURE) {
return; return;
} }
@ -865,7 +865,7 @@ PHP_FUNCTION(dom_document_create_comment)
dom_object *intern; dom_object *intern;
char *value; char *value;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &value, &value_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &value, &value_len) == FAILURE) {
return; return;
} }
@ -894,7 +894,7 @@ PHP_FUNCTION(dom_document_create_cdatasection)
dom_object *intern; dom_object *intern;
char *value; char *value;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &value, &value_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &value, &value_len) == FAILURE) {
return; return;
} }
@ -923,7 +923,7 @@ PHP_FUNCTION(dom_document_create_processing_instruction)
dom_object *intern; dom_object *intern;
char *name, *value = NULL; char *name, *value = NULL;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, U_CLASS_ENTRY(dom_document_class_entry), &name, &name_len, &value, &value_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, dom_document_class_entry, &name, &name_len, &value, &value_len) == FAILURE) {
return; return;
} }
@ -959,7 +959,7 @@ PHP_FUNCTION(dom_document_create_attribute)
dom_object *intern; dom_object *intern;
char *name; char *name;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &name, &name_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &name, &name_len) == FAILURE) {
return; return;
} }
@ -994,7 +994,7 @@ PHP_FUNCTION(dom_document_create_entity_reference)
int ret, name_len; int ret, name_len;
char *name; char *name;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &name, &name_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &name, &name_len) == FAILURE) {
return; return;
} }
@ -1028,7 +1028,7 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name)
char *name; char *name;
xmlChar *local; xmlChar *local;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &name, &name_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &name, &name_len) == FAILURE) {
return; return;
} }
@ -1056,7 +1056,7 @@ PHP_FUNCTION(dom_document_import_node)
int ret; int ret;
long recursive = 0; long recursive = 0;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|l", &id, U_CLASS_ENTRY(dom_document_class_entry), &node, U_CLASS_ENTRY(dom_node_class_entry), &recursive) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|l", &id, dom_document_class_entry, &node, dom_node_class_entry, &recursive) == FAILURE) {
return; return;
} }
@ -1101,7 +1101,7 @@ PHP_FUNCTION(dom_document_create_element_ns)
int errorcode; int errorcode;
dom_object *intern; dom_object *intern;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s|s", &id, U_CLASS_ENTRY(dom_document_class_entry), &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s|s", &id, dom_document_class_entry, &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) {
return; return;
} }
@ -1165,7 +1165,7 @@ PHP_FUNCTION(dom_document_create_attribute_ns)
dom_object *intern; dom_object *intern;
int errorcode; int errorcode;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, U_CLASS_ENTRY(dom_document_class_entry), &uri, &uri_len, &name, &name_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_document_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
return; return;
} }
@ -1228,7 +1228,7 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name_ns)
char *uri, *name; char *uri, *name;
xmlChar *local, *nsuri; xmlChar *local, *nsuri;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, U_CLASS_ENTRY(dom_document_class_entry), &uri, &uri_len, &name, &name_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, dom_document_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
return; return;
} }
@ -1256,7 +1256,7 @@ PHP_FUNCTION(dom_document_get_element_by_id)
dom_object *intern; dom_object *intern;
char *idname; char *idname;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &idname, &idname_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &idname, &idname_len) == FAILURE) {
return; return;
} }
@ -1295,7 +1295,7 @@ PHP_FUNCTION(dom_document_normalize_document)
xmlDocPtr docp; xmlDocPtr docp;
dom_object *intern; dom_object *intern;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_document_class_entry)) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_document_class_entry) == FAILURE) {
return; return;
} }
@ -1326,8 +1326,8 @@ PHP_METHOD(domdocument, __construct)
char *encoding, *version = NULL; char *encoding, *version = NULL;
int encoding_len = 0, version_len = 0, refcount; int encoding_len = 0, version_len = 0, refcount;
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(dom_domexception_class_entry) TSRMLS_CC); php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ss", &id, U_CLASS_ENTRY(dom_document_class_entry), &version, &version_len, &encoding, &encoding_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ss", &id, dom_document_class_entry, &version, &version_len, &encoding, &encoding_len) == FAILURE) {
php_std_error_handling(); php_std_error_handling();
return; return;
} }
@ -1534,7 +1534,7 @@ static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) {
long options = 0; long options = 0;
id = getThis(); id = getThis();
if (id != NULL && ! instanceof_function(Z_OBJCE_P(id), U_CLASS_ENTRY(dom_document_class_entry) TSRMLS_CC)) { if (id != NULL && ! instanceof_function(Z_OBJCE_P(id), dom_document_class_entry TSRMLS_CC)) {
id = NULL; id = NULL;
} }
@ -1613,7 +1613,7 @@ PHP_FUNCTION(dom_document_save)
char *file; char *file;
long options = 0; long options = 0;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &id, U_CLASS_ENTRY(dom_document_class_entry), &file, &file_len, &options) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &id, dom_document_class_entry, &file, &file_len, &options) == FAILURE) {
return; return;
} }
@ -1659,7 +1659,7 @@ PHP_FUNCTION(dom_document_savexml)
int size, format, saveempty; int size, format, saveempty;
long options = 0; long options = 0;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|O!l", &id, U_CLASS_ENTRY(dom_document_class_entry), &nodep, U_CLASS_ENTRY(dom_node_class_entry), &options) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|O!l", &id, dom_document_class_entry, &nodep, dom_node_class_entry, &options) == FAILURE) {
return; return;
} }
@ -1758,7 +1758,7 @@ PHP_FUNCTION(dom_document_xinclude)
int err; int err;
dom_object *intern; dom_object *intern;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &id, U_CLASS_ENTRY(dom_document_class_entry), &flags) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &id, dom_document_class_entry, &flags) == FAILURE) {
return; return;
} }
@ -1797,7 +1797,7 @@ PHP_FUNCTION(dom_document_validate)
dom_object *intern; dom_object *intern;
xmlValidCtxt *cvp; xmlValidCtxt *cvp;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_document_class_entry)) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_document_class_entry) == FAILURE) {
return; return;
} }
@ -1839,7 +1839,7 @@ _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type)
int is_valid; int is_valid;
char resolved_path[MAXPATHLEN + 1]; char resolved_path[MAXPATHLEN + 1];
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &source, &source_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
return; return;
} }
@ -1929,7 +1929,7 @@ _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int type)
int is_valid; int is_valid;
char resolved_path[MAXPATHLEN + 1]; char resolved_path[MAXPATHLEN + 1];
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &source, &source_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
return; return;
} }
@ -2053,7 +2053,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode)
if (!newdoc) if (!newdoc)
RETURN_FALSE; RETURN_FALSE;
if (id != NULL && instanceof_function(Z_OBJCE_P(id), U_CLASS_ENTRY(dom_document_class_entry) TSRMLS_CC)) { if (id != NULL && instanceof_function(Z_OBJCE_P(id), dom_document_class_entry TSRMLS_CC)) {
intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC); intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC);
if (intern != NULL) { if (intern != NULL) {
docp = (xmlDocPtr) dom_object_get_node(intern); docp = (xmlDocPtr) dom_object_get_node(intern);
@ -2110,7 +2110,7 @@ PHP_FUNCTION(dom_document_save_html_file)
dom_doc_propsptr doc_props; dom_doc_propsptr doc_props;
char *file; char *file;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_document_class_entry), &file, &file_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &file, &file_len) == FAILURE) {
return; return;
} }
@ -2145,7 +2145,7 @@ PHP_FUNCTION(dom_document_save_html)
xmlChar *mem; xmlChar *mem;
int size; int size;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_document_class_entry)) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_document_class_entry) == FAILURE) {
return; return;
} }
@ -2176,7 +2176,7 @@ PHP_METHOD(domdocument, registerNodeClass)
dom_object *intern; dom_object *intern;
zend_uchar type1, type2; zend_uchar type1, type2;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss!", &id, U_CLASS_ENTRY(dom_document_class_entry), &baseclass, &baseclass_len, &extendedclass, &extendedclass_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss!", &id, dom_document_class_entry, &baseclass, &baseclass_len, &extendedclass, &extendedclass_len) == FAILURE) {
return; return;
} }
@ -2189,7 +2189,7 @@ PHP_METHOD(domdocument, registerNodeClass)
basece = *pce; basece = *pce;
} }
if (basece == NULL || ! instanceof_function(basece, U_CLASS_ENTRY(dom_node_class_entry) TSRMLS_CC)) { if (basece == NULL || ! instanceof_function(basece, dom_node_class_entry TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s is not derived from DOMNode.", baseclass); php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s is not derived from DOMNode.", baseclass);
return; return;
} }

View file

@ -49,7 +49,7 @@ PHP_METHOD(domdocumentfragment, __construct)
xmlNodePtr nodep = NULL, oldnode = NULL; xmlNodePtr nodep = NULL, oldnode = NULL;
dom_object *intern; dom_object *intern;
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(dom_domexception_class_entry) TSRMLS_CC); php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_documentfragment_class_entry) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_documentfragment_class_entry) == FAILURE) {
php_std_error_handling(); php_std_error_handling();
return; return;

View file

@ -161,7 +161,7 @@ static int php_dom_iterator_current_key(zend_object_iterator *iter, char **str_k
object = (zval *)iterator->intern.data; object = (zval *)iterator->intern.data;
if (instanceof_function(Z_OBJCE_P(object), U_CLASS_ENTRY(dom_nodelist_class_entry) TSRMLS_CC)) { if (instanceof_function(Z_OBJCE_P(object), dom_nodelist_class_entry TSRMLS_CC)) {
*int_key = iter->index - 1; *int_key = iter->index - 1;
return HASH_KEY_IS_LONG; return HASH_KEY_IS_LONG;
} else { } else {

View file

@ -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) void php_dom_throw_error_with_message(int error_code, char *error_message, int strict_error TSRMLS_DC)
{ {
if (strict_error == 1) { if (strict_error == 1) {
zend_throw_exception(U_CLASS_ENTRY(dom_domexception_class_entry), error_message, error_code TSRMLS_CC); zend_throw_exception(dom_domexception_class_entry, error_message, error_code TSRMLS_CC);
} else { } else {
php_libxml_issue_error(E_WARNING, error_message TSRMLS_CC); php_libxml_issue_error(E_WARNING, error_message TSRMLS_CC);
} }

View file

@ -134,7 +134,7 @@ PHP_METHOD(domimplementation, createDocument)
char *prefix = NULL, *localname = NULL; char *prefix = NULL, *localname = NULL;
dom_object *doctobj; dom_object *doctobj;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ssO", &uri, &uri_len, &name, &name_len, &node, U_CLASS_ENTRY(dom_documenttype_class_entry)) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ssO", &uri, &uri_len, &name, &name_len, &node, dom_documenttype_class_entry) == FAILURE) {
return; return;
} }

View file

@ -71,8 +71,8 @@ PHP_METHOD(domelement, __construct)
int name_len, value_len = 0, name_valid; int name_len, value_len = 0, name_valid;
xmlNsPtr nsptr = NULL; xmlNsPtr nsptr = NULL;
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(dom_domexception_class_entry) TSRMLS_CC); php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s!s", &id, U_CLASS_ENTRY(dom_element_class_entry), &name, &name_len, &value, &value_len, &uri, &uri_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s!s", &id, dom_element_class_entry, &name, &name_len, &value, &value_len, &uri, &uri_len) == FAILURE) {
php_std_error_handling(); php_std_error_handling();
return; return;
} }
@ -202,7 +202,7 @@ PHP_FUNCTION(dom_element_get_attribute)
dom_object *intern; dom_object *intern;
int name_len; int name_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_element_class_entry), &name, &name_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
return; return;
} }
@ -233,7 +233,7 @@ PHP_FUNCTION(dom_element_set_attribute)
char *name, *value; char *name, *value;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, U_CLASS_ENTRY(dom_element_class_entry), &name, &name_len, &value, &value_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, dom_element_class_entry, &name, &name_len, &value, &value_len) == FAILURE) {
return; return;
} }
@ -278,7 +278,7 @@ PHP_FUNCTION(dom_element_remove_attribute)
int name_len; int name_len;
char *name; char *name;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_element_class_entry), &name, &name_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
return; return;
} }
@ -322,7 +322,7 @@ PHP_FUNCTION(dom_element_get_attribute_node)
dom_object *intern; dom_object *intern;
char *name; char *name;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_element_class_entry), &name, &name_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
return; return;
} }
@ -350,7 +350,7 @@ PHP_FUNCTION(dom_element_set_attribute_node)
dom_object *intern, *attrobj, *oldobj; dom_object *intern, *attrobj, *oldobj;
int ret; int ret;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, U_CLASS_ENTRY(dom_element_class_entry), &node, U_CLASS_ENTRY(dom_attr_class_entry)) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, dom_element_class_entry, &node, dom_attr_class_entry) == FAILURE) {
return; return;
} }
@ -413,7 +413,7 @@ PHP_FUNCTION(dom_element_remove_attribute_node)
dom_object *intern, *attrobj; dom_object *intern, *attrobj;
int ret; int ret;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, U_CLASS_ENTRY(dom_element_class_entry), &node, U_CLASS_ENTRY(dom_attr_class_entry)) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, dom_element_class_entry, &node, dom_attr_class_entry) == FAILURE) {
return; return;
} }
@ -452,7 +452,7 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name)
char *name; char *name;
xmlChar *local; xmlChar *local;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_element_class_entry), &name, &name_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
return; return;
} }
@ -479,7 +479,7 @@ PHP_FUNCTION(dom_element_get_attribute_ns)
int uri_len = 0, name_len = 0; int uri_len = 0, name_len = 0;
char *uri, *name, *strattr; char *uri, *name, *strattr;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, U_CLASS_ENTRY(dom_element_class_entry), &uri, &uri_len, &name, &name_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
return; return;
} }
@ -559,7 +559,7 @@ PHP_FUNCTION(dom_element_set_attribute_ns)
dom_object *intern; dom_object *intern;
int errorcode = 0, stricterror, is_xmlns = 0; int errorcode = 0, stricterror, is_xmlns = 0;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!ss", &id, U_CLASS_ENTRY(dom_element_class_entry), &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!ss", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) {
return; return;
} }
@ -668,7 +668,7 @@ PHP_FUNCTION(dom_element_remove_attribute_ns)
int name_len, uri_len; int name_len, uri_len;
char *name, *uri; char *name, *uri;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, U_CLASS_ENTRY(dom_element_class_entry), &uri, &uri_len, &name, &name_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
return; return;
} }
@ -725,7 +725,7 @@ PHP_FUNCTION(dom_element_get_attribute_node_ns)
int uri_len, name_len, ret; int uri_len, name_len, ret;
char *uri, *name; char *uri, *name;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, U_CLASS_ENTRY(dom_element_class_entry), &uri, &uri_len, &name, &name_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
return; return;
} }
@ -756,7 +756,7 @@ PHP_FUNCTION(dom_element_set_attribute_node_ns)
dom_object *intern, *attrobj, *oldobj; dom_object *intern, *attrobj, *oldobj;
int ret; int ret;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, U_CLASS_ENTRY(dom_element_class_entry), &node, U_CLASS_ENTRY(dom_attr_class_entry)) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, dom_element_class_entry, &node, dom_attr_class_entry) == FAILURE) {
return; return;
} }
@ -827,7 +827,7 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name_ns)
char *uri, *name; char *uri, *name;
xmlChar *local, *nsuri; xmlChar *local, *nsuri;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, U_CLASS_ENTRY(dom_element_class_entry), &uri, &uri_len, &name, &name_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
return; return;
} }
@ -855,7 +855,7 @@ PHP_FUNCTION(dom_element_has_attribute)
char *name, *value; char *name, *value;
int name_len; int name_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_element_class_entry), &name, &name_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
return; return;
} }
@ -885,7 +885,7 @@ PHP_FUNCTION(dom_element_has_attribute_ns)
int uri_len, name_len; int uri_len, name_len;
char *uri, *name, *value; char *uri, *name, *value;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, U_CLASS_ENTRY(dom_element_class_entry), &uri, &uri_len, &name, &name_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
return; return;
} }
@ -942,7 +942,7 @@ PHP_FUNCTION(dom_element_set_id_attribute)
int name_len; int name_len;
zend_bool is_id; zend_bool is_id;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Osb", &id, U_CLASS_ENTRY(dom_element_class_entry), &name, &name_len, &is_id) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Osb", &id, dom_element_class_entry, &name, &name_len, &is_id) == FAILURE) {
return; return;
} }
@ -979,7 +979,7 @@ PHP_FUNCTION(dom_element_set_id_attribute_ns)
char *uri, *name; char *uri, *name;
zend_bool is_id; zend_bool is_id;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ossb", &id, U_CLASS_ENTRY(dom_element_class_entry), &uri, &uri_len, &name, &name_len, &is_id) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ossb", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len, &is_id) == FAILURE) {
return; return;
} }
@ -1016,7 +1016,7 @@ PHP_FUNCTION(dom_element_set_id_attribute_node)
int name_len; int name_len;
zend_bool is_id; zend_bool is_id;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OOb", &id, U_CLASS_ENTRY(dom_element_class_entry), &node, U_CLASS_ENTRY(dom_attr_class_entry), &is_id) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OOb", &id, dom_element_class_entry, &node, dom_attr_class_entry, &is_id) == FAILURE) {
return; return;
} }

View file

@ -50,8 +50,8 @@ PHP_METHOD(domentityreference, __construct)
char *name; char *name;
int name_len, name_valid; int name_len, name_valid;
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(dom_domexception_class_entry) TSRMLS_CC); php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_entityreference_class_entry), &name, &name_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_entityreference_class_entry, &name, &name_len) == FAILURE) {
php_std_error_handling(); php_std_error_handling();
return; return;
} }

View file

@ -104,7 +104,7 @@ PHP_FUNCTION(dom_namednodemap_get_named_item)
xmlNodePtr nodep; xmlNodePtr nodep;
xmlNotation *notep = NULL; xmlNotation *notep = NULL;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_namednodemap_class_entry), &named, &namedlen) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_namednodemap_class_entry, &named, &namedlen) == FAILURE) {
return; return;
} }
@ -176,7 +176,7 @@ PHP_FUNCTION(dom_namednodemap_item)
xmlNodePtr nodep, curnode; xmlNodePtr nodep, curnode;
int count; int count;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, U_CLASS_ENTRY(dom_namednodemap_class_entry), &index) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, dom_namednodemap_class_entry, &index) == FAILURE) {
return; return;
} }
if (index >= 0) { if (index >= 0) {
@ -232,7 +232,7 @@ PHP_FUNCTION(dom_namednodemap_get_named_item_ns)
xmlNodePtr nodep; xmlNodePtr nodep;
xmlNotation *notep = NULL; xmlNotation *notep = NULL;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, U_CLASS_ENTRY(dom_namednodemap_class_entry), &uri, &urilen, &named, &namedlen) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_namednodemap_class_entry, &uri, &urilen, &named, &namedlen) == FAILURE) {
return; return;
} }

View file

@ -913,7 +913,7 @@ PHP_FUNCTION(dom_node_insert_before)
dom_object *intern, *childobj, *refpobj; dom_object *intern, *childobj, *refpobj;
int ret, stricterror; int ret, stricterror;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|O!", &id, U_CLASS_ENTRY(dom_node_class_entry), &node, U_CLASS_ENTRY(dom_node_class_entry), &ref, U_CLASS_ENTRY(dom_node_class_entry)) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|O!", &id, dom_node_class_entry, &node, dom_node_class_entry, &ref, dom_node_class_entry) == FAILURE) {
return; return;
} }
@ -1077,7 +1077,7 @@ PHP_FUNCTION(dom_node_replace_child)
int ret; int ret;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OOO", &id, U_CLASS_ENTRY(dom_node_class_entry), &newnode, U_CLASS_ENTRY(dom_node_class_entry), &oldnode, U_CLASS_ENTRY(dom_node_class_entry)) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OOO", &id, dom_node_class_entry, &newnode, dom_node_class_entry, &oldnode, dom_node_class_entry) == FAILURE) {
return; return;
} }
@ -1167,7 +1167,7 @@ PHP_FUNCTION(dom_node_remove_child)
dom_object *intern, *childobj; dom_object *intern, *childobj;
int ret, stricterror; int ret, stricterror;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, U_CLASS_ENTRY(dom_node_class_entry), &node, U_CLASS_ENTRY(dom_node_class_entry)) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, dom_node_class_entry, &node, dom_node_class_entry) == FAILURE) {
return; return;
} }
@ -1220,7 +1220,7 @@ PHP_FUNCTION(dom_node_append_child)
dom_object *intern, *childobj; dom_object *intern, *childobj;
int ret, stricterror; int ret, stricterror;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, U_CLASS_ENTRY(dom_node_class_entry), &node, U_CLASS_ENTRY(dom_node_class_entry)) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, dom_node_class_entry, &node, dom_node_class_entry) == FAILURE) {
return; return;
} }
@ -1321,7 +1321,7 @@ PHP_FUNCTION(dom_node_has_child_nodes)
xmlNode *nodep; xmlNode *nodep;
dom_object *intern; dom_object *intern;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_node_class_entry)) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_node_class_entry) == FAILURE) {
return; return;
} }
@ -1353,7 +1353,7 @@ PHP_FUNCTION(dom_node_clone_node)
dom_object *intern; dom_object *intern;
long recursive = 0; long recursive = 0;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &id, U_CLASS_ENTRY(dom_node_class_entry), &recursive) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &id, dom_node_class_entry, &recursive) == FAILURE) {
return; return;
} }
@ -1414,7 +1414,7 @@ PHP_FUNCTION(dom_node_normalize)
xmlNode *nodep; xmlNode *nodep;
dom_object *intern; dom_object *intern;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_node_class_entry)) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_node_class_entry) == FAILURE) {
return; return;
} }
@ -1436,7 +1436,7 @@ PHP_FUNCTION(dom_node_is_supported)
int feature_len, version_len; int feature_len, version_len;
char *feature, *version; char *feature, *version;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, U_CLASS_ENTRY(dom_node_class_entry), &feature, &feature_len, &version, &version_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, dom_node_class_entry, &feature, &feature_len, &version, &version_len) == FAILURE) {
return; return;
} }
@ -1459,7 +1459,7 @@ PHP_FUNCTION(dom_node_has_attributes)
xmlNode *nodep; xmlNode *nodep;
dom_object *intern; dom_object *intern;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_node_class_entry)) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_node_class_entry) == FAILURE) {
return; return;
} }
@ -1497,7 +1497,7 @@ PHP_FUNCTION(dom_node_is_same_node)
xmlNodePtr nodeotherp, nodep; xmlNodePtr nodeotherp, nodep;
dom_object *intern, *nodeotherobj; dom_object *intern, *nodeotherobj;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, U_CLASS_ENTRY(dom_node_class_entry), &node, U_CLASS_ENTRY(dom_node_class_entry)) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, dom_node_class_entry, &node, dom_node_class_entry) == FAILURE) {
return; return;
} }
@ -1527,7 +1527,7 @@ PHP_FUNCTION(dom_node_lookup_prefix)
int uri_len = 0; int uri_len = 0;
char *uri; char *uri;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_node_class_entry), &uri, &uri_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_node_class_entry, &uri, &uri_len) == FAILURE) {
return; return;
} }
@ -1578,7 +1578,7 @@ PHP_FUNCTION(dom_node_is_default_namespace)
int uri_len = 0; int uri_len = 0;
char *uri; char *uri;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_node_class_entry), &uri, &uri_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_node_class_entry, &uri, &uri_len) == FAILURE) {
return; return;
} }
@ -1609,7 +1609,7 @@ PHP_FUNCTION(dom_node_lookup_namespace_uri)
int prefix_len = 0; int prefix_len = 0;
char *prefix; char *prefix;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, U_CLASS_ENTRY(dom_node_class_entry), &prefix, &prefix_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_node_class_entry, &prefix, &prefix_len) == FAILURE) {
return; return;
} }

View file

@ -111,7 +111,7 @@ PHP_FUNCTION(dom_nodelist_item)
HashTable *nodeht; HashTable *nodeht;
zval **entry; zval **entry;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, U_CLASS_ENTRY(dom_nodelist_class_entry), &index) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, dom_nodelist_class_entry, &index) == FAILURE) {
return; return;
} }

View file

@ -1049,7 +1049,7 @@ void dom_objects_clone(void *object, void **object_clone TSRMLS_DC)
clone = dom_objects_set_class(intern->std.ce, 0 TSRMLS_CC); clone = dom_objects_set_class(intern->std.ce, 0 TSRMLS_CC);
if (instanceof_function(intern->std.ce, U_CLASS_ENTRY(dom_node_class_entry) TSRMLS_CC)) { if (instanceof_function(intern->std.ce, dom_node_class_entry TSRMLS_CC)) {
node = (xmlNodePtr)dom_object_get_node((dom_object *) object); node = (xmlNodePtr)dom_object_get_node((dom_object *) object);
if (node != NULL) { if (node != NULL) {
cloned_node = xmlDocCopyNode(node, node->doc, 1); cloned_node = xmlDocCopyNode(node, node->doc, 1);
@ -1170,9 +1170,9 @@ void php_dom_create_interator(zval *return_value, int ce_type TSRMLS_DC)
zend_class_entry *ce; zend_class_entry *ce;
if (ce_type == DOM_NAMEDNODEMAP) { if (ce_type == DOM_NAMEDNODEMAP) {
ce = U_CLASS_ENTRY(dom_namednodemap_class_entry); ce = dom_namednodemap_class_entry;
} else { } else {
ce = U_CLASS_ENTRY(dom_nodelist_class_entry); ce = dom_nodelist_class_entry;
} }
object_init_ex(return_value, ce); object_init_ex(return_value, ce);
@ -1209,69 +1209,69 @@ PHP_DOM_EXPORT zval *php_dom_create_object(xmlNodePtr obj, int *found, zval *wra
case XML_DOCUMENT_NODE: case XML_DOCUMENT_NODE:
case XML_HTML_DOCUMENT_NODE: case XML_HTML_DOCUMENT_NODE:
{ {
ce = U_CLASS_ENTRY(dom_document_class_entry); ce = dom_document_class_entry;
break; break;
} }
case XML_DTD_NODE: case XML_DTD_NODE:
case XML_DOCUMENT_TYPE_NODE: case XML_DOCUMENT_TYPE_NODE:
{ {
ce = U_CLASS_ENTRY(dom_documenttype_class_entry); ce = dom_documenttype_class_entry;
break; break;
} }
case XML_ELEMENT_NODE: case XML_ELEMENT_NODE:
{ {
ce = U_CLASS_ENTRY(dom_element_class_entry); ce = dom_element_class_entry;
break; break;
} }
case XML_ATTRIBUTE_NODE: case XML_ATTRIBUTE_NODE:
{ {
ce = U_CLASS_ENTRY(dom_attr_class_entry); ce = dom_attr_class_entry;
break; break;
} }
case XML_TEXT_NODE: case XML_TEXT_NODE:
{ {
ce = U_CLASS_ENTRY(dom_text_class_entry); ce = dom_text_class_entry;
break; break;
} }
case XML_COMMENT_NODE: case XML_COMMENT_NODE:
{ {
ce = U_CLASS_ENTRY(dom_comment_class_entry); ce = dom_comment_class_entry;
break; break;
} }
case XML_PI_NODE: case XML_PI_NODE:
{ {
ce = U_CLASS_ENTRY(dom_processinginstruction_class_entry); ce = dom_processinginstruction_class_entry;
break; break;
} }
case XML_ENTITY_REF_NODE: case XML_ENTITY_REF_NODE:
{ {
ce = U_CLASS_ENTRY(dom_entityreference_class_entry); ce = dom_entityreference_class_entry;
break; break;
} }
case XML_ENTITY_DECL: case XML_ENTITY_DECL:
case XML_ELEMENT_DECL: case XML_ELEMENT_DECL:
{ {
ce = U_CLASS_ENTRY(dom_entity_class_entry); ce = dom_entity_class_entry;
break; break;
} }
case XML_CDATA_SECTION_NODE: case XML_CDATA_SECTION_NODE:
{ {
ce = U_CLASS_ENTRY(dom_cdatasection_class_entry); ce = dom_cdatasection_class_entry;
break; break;
} }
case XML_DOCUMENT_FRAG_NODE: case XML_DOCUMENT_FRAG_NODE:
{ {
ce = U_CLASS_ENTRY(dom_documentfragment_class_entry); ce = dom_documentfragment_class_entry;
break; break;
} }
case XML_NOTATION_NODE: case XML_NOTATION_NODE:
{ {
ce = U_CLASS_ENTRY(dom_notation_class_entry); ce = dom_notation_class_entry;
break; break;
} }
case XML_NAMESPACE_DECL: case XML_NAMESPACE_DECL:
{ {
ce = U_CLASS_ENTRY(dom_namespace_node_class_entry); ce = dom_namespace_node_class_entry;
break; break;
} }
default: default:
@ -1300,7 +1300,7 @@ PHP_DOM_EXPORT zval *php_dom_create_object(xmlNodePtr obj, int *found, zval *wra
void php_dom_create_implementation(zval **retval TSRMLS_DC) { void php_dom_create_implementation(zval **retval TSRMLS_DC) {
object_init_ex(*retval, U_CLASS_ENTRY(dom_domimplementation_class_entry)); object_init_ex(*retval, dom_domimplementation_class_entry);
} }
/* {{{ int dom_hierarchy(xmlNodePtr parent, xmlNodePtr child) */ /* {{{ int dom_hierarchy(xmlNodePtr parent, xmlNodePtr child) */

View file

@ -50,8 +50,8 @@ PHP_METHOD(domprocessinginstruction, __construct)
char *name, *value = NULL; char *name, *value = NULL;
int name_len, value_len, name_valid; int name_len, value_len, name_valid;
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(dom_domexception_class_entry) TSRMLS_CC); php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, U_CLASS_ENTRY(dom_processinginstruction_class_entry), &name, &name_len, &value, &value_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, dom_processinginstruction_class_entry, &name, &name_len, &value, &value_len) == FAILURE) {
php_std_error_handling(); php_std_error_handling();
return; return;
} }

View file

@ -54,8 +54,8 @@ PHP_METHOD(domtext, __construct)
char *value = NULL; char *value = NULL;
int value_len; int value_len;
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(dom_domexception_class_entry) TSRMLS_CC); php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|s", &id, U_CLASS_ENTRY(dom_text_class_entry), &value, &value_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|s", &id, dom_text_class_entry, &value, &value_len) == FAILURE) {
php_std_error_handling(); php_std_error_handling();
return; return;
} }
@ -125,7 +125,7 @@ PHP_FUNCTION(dom_text_split_text)
int length; int length;
dom_object *intern; dom_object *intern;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, U_CLASS_ENTRY(dom_text_class_entry), &offset) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, dom_text_class_entry, &offset) == FAILURE) {
return; return;
} }
DOM_GET_OBJ(node, id, xmlNodePtr, intern); DOM_GET_OBJ(node, id, xmlNodePtr, intern);
@ -177,7 +177,7 @@ PHP_FUNCTION(dom_text_is_whitespace_in_element_content)
xmlNodePtr node; xmlNodePtr node;
dom_object *intern; dom_object *intern;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, U_CLASS_ENTRY(dom_text_class_entry)) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_text_class_entry) == FAILURE) {
return; return;
} }
DOM_GET_OBJ(node, id, xmlNodePtr, intern); DOM_GET_OBJ(node, id, xmlNodePtr, intern);

View file

@ -52,8 +52,8 @@ PHP_METHOD(domxpath, __construct)
dom_object *docobj, *intern; dom_object *docobj, *intern;
xmlXPathContextPtr ctx, oldctx; xmlXPathContextPtr ctx, oldctx;
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(dom_domexception_class_entry) TSRMLS_CC); php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, U_CLASS_ENTRY(dom_xpath_class_entry), &doc, U_CLASS_ENTRY(dom_document_class_entry)) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, dom_xpath_class_entry, &doc, dom_document_class_entry) == FAILURE) {
php_std_error_handling(); php_std_error_handling();
return; return;
} }
@ -111,7 +111,7 @@ PHP_FUNCTION(dom_xpath_register_ns)
dom_object *intern; dom_object *intern;
unsigned char *prefix, *ns_uri; unsigned char *prefix, *ns_uri;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, U_CLASS_ENTRY(dom_xpath_class_entry), &prefix, &prefix_len, &ns_uri, &ns_uri_len) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, dom_xpath_class_entry, &prefix, &prefix_len, &ns_uri, &ns_uri_len) == FAILURE) {
return; return;
} }
@ -151,7 +151,7 @@ static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) {
xmlNsPtr *ns; xmlNsPtr *ns;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|O", &id, U_CLASS_ENTRY(dom_xpath_class_entry), &expr, &expr_len, &context, U_CLASS_ENTRY(dom_node_class_entry)) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|O", &id, dom_xpath_class_entry, &expr, &expr_len, &context, dom_node_class_entry) == FAILURE) {
return; return;
} }

View file

@ -55,7 +55,7 @@ zend_class_entry *pdo_exception_ce;
PDO_API zend_class_entry *php_pdo_get_exception(TSRMLS_D) PDO_API zend_class_entry *php_pdo_get_exception(TSRMLS_D)
{ {
return U_CLASS_ENTRY(pdo_exception_ce); return pdo_exception_ce;
} }
PDO_API char *php_pdo_str_tolower_dup(const char *src, int len) PDO_API char *php_pdo_str_tolower_dup(const char *src, int len)

View file

@ -508,7 +508,7 @@ static PHP_METHOD(PDO, prepare)
RETURN_FALSE; RETURN_FALSE;
} }
dbstmt_ce = *pce; dbstmt_ce = *pce;
if (!instanceof_function(dbstmt_ce, U_CLASS_ENTRY(pdo_dbstmt_ce) TSRMLS_CC)) { if (!instanceof_function(dbstmt_ce, pdo_dbstmt_ce TSRMLS_CC)) {
pdo_raise_impl_error(dbh, NULL, "HY000", pdo_raise_impl_error(dbh, NULL, "HY000",
"user-supplied statement class must be derived from PDOStatement" TSRMLS_CC); "user-supplied statement class must be derived from PDOStatement" TSRMLS_CC);
PDO_HANDLE_DBH_ERR(); PDO_HANDLE_DBH_ERR();
@ -727,7 +727,7 @@ static PHP_METHOD(PDO, setAttribute)
PDO_HANDLE_DBH_ERR(); PDO_HANDLE_DBH_ERR();
RETURN_FALSE; RETURN_FALSE;
} }
if (!instanceof_function(*pce, U_CLASS_ENTRY(pdo_dbstmt_ce) TSRMLS_CC)) { if (!instanceof_function(*pce, pdo_dbstmt_ce TSRMLS_CC)) {
pdo_raise_impl_error(dbh, NULL, "HY000", pdo_raise_impl_error(dbh, NULL, "HY000",
"user-supplied statement class must be derived from PDOStatement" TSRMLS_CC); "user-supplied statement class must be derived from PDOStatement" TSRMLS_CC);
PDO_HANDLE_DBH_ERR(); PDO_HANDLE_DBH_ERR();
@ -1372,7 +1372,7 @@ zend_object_value pdo_dbh_new(zend_class_entry *ce TSRMLS_DC)
ALLOC_HASHTABLE(dbh->properties); ALLOC_HASHTABLE(dbh->properties);
zend_hash_init(dbh->properties, 0, NULL, ZVAL_PTR_DTOR, 0); zend_hash_init(dbh->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
zend_hash_copy(dbh->properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); zend_hash_copy(dbh->properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
dbh->def_stmt_ce = U_CLASS_ENTRY(pdo_dbstmt_ce); dbh->def_stmt_ce = pdo_dbstmt_ce;
retval.handle = zend_objects_store_put(dbh, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t)pdo_dbh_free_storage, NULL TSRMLS_CC); retval.handle = zend_objects_store_put(dbh, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t)pdo_dbh_free_storage, NULL TSRMLS_CC);
retval.handlers = &pdo_dbh_object_handlers; retval.handlers = &pdo_dbh_object_handlers;

View file

@ -1178,7 +1178,7 @@ static PHP_METHOD(PDOStatement, fetchObject)
switch(ZEND_NUM_ARGS()) { switch(ZEND_NUM_ARGS()) {
case 0: case 0:
stmt->fetch.cls.ce = U_CLASS_ENTRY(zend_standard_class_def); stmt->fetch.cls.ce = zend_standard_class_def;
break; break;
case 2: case 2:
if (Z_TYPE_P(ctor_args) != IS_NULL && Z_TYPE_P(ctor_args) != IS_ARRAY) { if (Z_TYPE_P(ctor_args) != IS_NULL && Z_TYPE_P(ctor_args) != IS_ARRAY) {
@ -1274,7 +1274,7 @@ static PHP_METHOD(PDOStatement, fetchAll)
switch(ZEND_NUM_ARGS()) { switch(ZEND_NUM_ARGS()) {
case 0: case 0:
case 1: case 1:
stmt->fetch.cls.ce = U_CLASS_ENTRY(zend_standard_class_def); stmt->fetch.cls.ce = zend_standard_class_def;
break; break;
case 3: case 3:
if (Z_TYPE_P(ctor_args) != IS_NULL && Z_TYPE_P(ctor_args) != IS_ARRAY) { if (Z_TYPE_P(ctor_args) != IS_NULL && Z_TYPE_P(ctor_args) != IS_ARRAY) {
@ -2406,7 +2406,7 @@ static union _zend_function *row_get_ctor(zval *object TSRMLS_DC)
static zend_class_entry *row_get_ce(zval *object TSRMLS_DC) static zend_class_entry *row_get_ce(zval *object TSRMLS_DC)
{ {
return U_CLASS_ENTRY(pdo_dbstmt_ce); return pdo_dbstmt_ce;
} }
static int row_get_classname(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC) static int row_get_classname(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC)

View file

@ -27,7 +27,6 @@
# define ZVAL_RT_STRINGL(a, b, c, d) ZVAL_STRINGL(a, b, c, d) # define ZVAL_RT_STRINGL(a, b, c, d) ZVAL_STRINGL(a, b, c, d)
# define ZVAL_ASCII_STRINGL(a, b, c, d) ZVAL_STRINGL(a, b, c, d) # define ZVAL_ASCII_STRINGL(a, b, c, d) ZVAL_STRINGL(a, b, c, d)
# define U_CLASS_ENTRY(ce) ce
# define PDO_ZVAL_PP_IS_TEXT(pp) (Z_TYPE_PP(pp) == IS_STRING) # define PDO_ZVAL_PP_IS_TEXT(pp) (Z_TYPE_PP(pp) == IS_STRING)
# define PDO_ZVAL_P_IS_TEXT(pp) (Z_TYPE_P(pp) == IS_STRING) # define PDO_ZVAL_P_IS_TEXT(pp) (Z_TYPE_P(pp) == IS_STRING)
# define Z_UNIVAL_PP(x) Z_STRVAL_PP(x) # define Z_UNIVAL_PP(x) Z_STRVAL_PP(x)

View file

@ -71,7 +71,7 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection)
/* Method macros */ /* Method macros */
#define METHOD_NOTSTATIC(ce) \ #define METHOD_NOTSTATIC(ce) \
if (!this_ptr || !instanceof_function(Z_OBJCE_P(this_ptr), U_CLASS_ENTRY(ce) TSRMLS_CC)) { \ if (!this_ptr || !instanceof_function(Z_OBJCE_P(this_ptr), ce TSRMLS_CC)) { \
zend_error(E_ERROR, "%v() cannot be called statically", get_active_function_name(TSRMLS_C)); \ zend_error(E_ERROR, "%v() cannot be called statically", get_active_function_name(TSRMLS_C)); \
return; \ return; \
} \ } \
@ -83,11 +83,11 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection)
/* Exception throwing macro */ /* Exception throwing macro */
#define _DO_THROW(msg) \ #define _DO_THROW(msg) \
zend_throw_exception(U_CLASS_ENTRY(reflection_exception_ptr), msg, 0 TSRMLS_CC); \ zend_throw_exception(reflection_exception_ptr, msg, 0 TSRMLS_CC); \
return; \ return; \
#define RETURN_ON_EXCEPTION \ #define RETURN_ON_EXCEPTION \
if (EG(exception) && Z_OBJCE_P(EG(exception)) == U_CLASS_ENTRY(reflection_exception_ptr)) { \ if (EG(exception) && Z_OBJCE_P(EG(exception)) == reflection_exception_ptr) { \
return; \ return; \
} }
@ -960,7 +960,7 @@ PHPAPI void zend_reflection_class_factory(zend_class_entry *ce, zval *object TSR
MAKE_STD_ZVAL(name); MAKE_STD_ZVAL(name);
ZVAL_TEXTL(name, ce->name, ce->name_length, 1); ZVAL_TEXTL(name, ce->name, ce->name_length, 1);
reflection_instanciate(U_CLASS_ENTRY(reflection_class_ptr), object TSRMLS_CC); reflection_instanciate(reflection_class_ptr, object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
intern->ptr = ce; intern->ptr = ce;
intern->free_ptr = 0; intern->free_ptr = 0;
@ -986,7 +986,7 @@ static void reflection_extension_factory(zval *object, char *name_str TSRMLS_DC)
} }
free_alloca(lcname); free_alloca(lcname);
reflection_instanciate(U_CLASS_ENTRY(reflection_extension_ptr), object TSRMLS_CC); reflection_instanciate(reflection_extension_ptr, object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
MAKE_STD_ZVAL(name); MAKE_STD_ZVAL(name);
ZVAL_STRINGL(name, module->name, name_len, 1); ZVAL_STRINGL(name, module->name, name_len, 1);
@ -1010,7 +1010,7 @@ static void reflection_parameter_factory(zend_function *fptr, struct _zend_arg_i
} else { } else {
ZVAL_NULL(name); ZVAL_NULL(name);
} }
reflection_instanciate(U_CLASS_ENTRY(reflection_parameter_ptr), object TSRMLS_CC); reflection_instanciate(reflection_parameter_ptr, object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
reference = (parameter_reference*) emalloc(sizeof(parameter_reference)); reference = (parameter_reference*) emalloc(sizeof(parameter_reference));
reference->arg_info = arg_info; reference->arg_info = arg_info;
@ -1033,7 +1033,7 @@ static void reflection_function_factory(zend_function *function, zval *object TS
MAKE_STD_ZVAL(name); MAKE_STD_ZVAL(name);
ZVAL_TEXT(name, function->common.function_name, 1); ZVAL_TEXT(name, function->common.function_name, 1);
reflection_instanciate(U_CLASS_ENTRY(reflection_function_ptr), object TSRMLS_CC); reflection_instanciate(reflection_function_ptr, object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
intern->ptr = function; intern->ptr = function;
intern->free_ptr = 0; intern->free_ptr = 0;
@ -1053,7 +1053,7 @@ static void reflection_method_factory(zend_class_entry *ce, zend_function *metho
MAKE_STD_ZVAL(classname); MAKE_STD_ZVAL(classname);
ZVAL_TEXT(name, method->common.function_name, 1); ZVAL_TEXT(name, method->common.function_name, 1);
ZVAL_TEXTL(classname, ce->name, ce->name_length, 1); ZVAL_TEXTL(classname, ce->name, ce->name_length, 1);
reflection_instanciate(U_CLASS_ENTRY(reflection_method_ptr), object TSRMLS_CC); reflection_instanciate(reflection_method_ptr, object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
intern->ptr = method; intern->ptr = method;
intern->free_ptr = 0; intern->free_ptr = 0;
@ -1091,7 +1091,7 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info
ZVAL_TEXT(name, prop_name, 1); ZVAL_TEXT(name, prop_name, 1);
ZVAL_TEXTL(classname, ce->name, ce->name_length, 1); ZVAL_TEXTL(classname, ce->name, ce->name_length, 1);
reflection_instanciate(U_CLASS_ENTRY(reflection_property_ptr), object TSRMLS_CC); reflection_instanciate(reflection_property_ptr, object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
reference = (property_reference*) emalloc(sizeof(property_reference)); reference = (property_reference*) emalloc(sizeof(property_reference));
reference->ce = ce; reference->ce = ce;
@ -1175,7 +1175,7 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
params[1] = &output_ptr; params[1] = &output_ptr;
ZVAL_STRINGL(&fname, "export", sizeof("export") - 1, 0); ZVAL_STRINGL(&fname, "export", sizeof("export") - 1, 0);
fci.function_table = &U_CLASS_ENTRY(reflection_ptr)->function_table; fci.function_table = &reflection_ptr->function_table;
fci.function_name = &fname; fci.function_name = &fname;
fci.object_pp = NULL; fci.object_pp = NULL;
fci.retval_ptr_ptr = &retval_ptr; fci.retval_ptr_ptr = &retval_ptr;
@ -1218,7 +1218,7 @@ ZEND_METHOD(reflection, export)
int result; int result;
zend_bool return_output = 0; zend_bool return_output = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &object, U_CLASS_ENTRY(reflector_ptr), &return_output) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &object, reflector_ptr, &return_output) == FAILURE) {
return; return;
} }
@ -1290,7 +1290,7 @@ ZEND_METHOD(reflection, getModifierNames)
Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
ZEND_METHOD(reflection_function, export) ZEND_METHOD(reflection_function, export)
{ {
_reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_function_ptr), 1); _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_function_ptr, 1);
} }
/* }}} */ /* }}} */
@ -1320,7 +1320,7 @@ ZEND_METHOD(reflection_function, __construct)
lcname = zend_u_str_case_fold(type, name_str, name_len, 1, &lcname_len); 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) { if (zend_u_hash_find(EG(function_table), type, lcname, lcname_len + 1, (void **)&fptr) == FAILURE) {
efree(lcname); efree(lcname);
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Function %R() does not exist", type, name_str); "Function %R() does not exist", type, name_str);
return; return;
} }
@ -1511,7 +1511,7 @@ ZEND_METHOD(reflection_function, invoke)
efree(params); efree(params);
if (result == FAILURE) { if (result == FAILURE) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Invocation of function %v() failed", fptr->common.function_name); "Invocation of function %v() failed", fptr->common.function_name);
return; return;
} }
@ -1575,7 +1575,7 @@ ZEND_METHOD(reflection_function, invokeArgs)
efree(params); efree(params);
if (result == FAILURE) { if (result == FAILURE) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Invocation of function %v() failed", fptr->common.function_name); "Invocation of function %v() failed", fptr->common.function_name);
return; return;
} }
@ -1707,7 +1707,7 @@ ZEND_METHOD(reflection_function, getExtensionName)
Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
ZEND_METHOD(reflection_parameter, export) ZEND_METHOD(reflection_parameter, export)
{ {
_reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_parameter_ptr), 2); _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_parameter_ptr, 2);
} }
/* }}} */ /* }}} */
@ -1746,7 +1746,7 @@ ZEND_METHOD(reflection_parameter, __construct)
lcname = zend_u_str_case_fold(Z_TYPE_P(reference), Z_UNIVAL_P(reference), Z_UNILEN_P(reference), 1, &lcname_len); lcname = zend_u_str_case_fold(Z_TYPE_P(reference), Z_UNIVAL_P(reference), Z_UNILEN_P(reference), 1, &lcname_len);
if (zend_u_hash_find(EG(function_table), Z_TYPE_P(reference), lcname, lcname_len + 1, (void**) &fptr) == FAILURE) { if (zend_u_hash_find(EG(function_table), Z_TYPE_P(reference), lcname, lcname_len + 1, (void**) &fptr) == FAILURE) {
efree(lcname); efree(lcname);
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Function %R() does not exist", Z_TYPE_P(reference), Z_UNIVAL_P(reference)); "Function %R() does not exist", Z_TYPE_P(reference), Z_UNIVAL_P(reference));
return; return;
} }
@ -1772,7 +1772,7 @@ ZEND_METHOD(reflection_parameter, __construct)
} else { } else {
convert_to_text_ex(classref); 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) { if (zend_u_lookup_class(Z_TYPE_PP(classref), Z_UNIVAL_PP(classref), Z_UNILEN_PP(classref), &pce TSRMLS_CC) == FAILURE) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Class %R does not exist", Z_TYPE_PP(classref), Z_UNIVAL_PP(classref)); "Class %R does not exist", Z_TYPE_PP(classref), Z_UNIVAL_PP(classref));
return; return;
} }
@ -1783,7 +1783,7 @@ ZEND_METHOD(reflection_parameter, __construct)
lcname = zend_u_str_case_fold(Z_TYPE_PP(method), Z_UNIVAL_PP(method), Z_UNILEN_PP(method), 1, &lcname_len); 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) { if (zend_u_hash_find(&ce->function_table, Z_TYPE_PP(method), lcname, lcname_len + 1, (void **) &fptr) == FAILURE) {
efree(lcname); efree(lcname);
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Method %R::%R() does not exist", Z_TYPE_PP(classref), Z_UNIVAL_PP(classref), Z_TYPE_PP(method), Z_UNIVAL_PP(method)); "Method %R::%R() does not exist", Z_TYPE_PP(classref), Z_UNIVAL_PP(classref), Z_TYPE_PP(method), Z_UNIVAL_PP(method));
return; return;
} }
@ -1881,7 +1881,7 @@ ZEND_METHOD(reflection_parameter, getClass)
zend_class_entry **pce; zend_class_entry **pce;
if (zend_u_lookup_class_ex(UG(unicode)?IS_UNICODE:IS_STRING, param->arg_info->class_name, param->arg_info->class_name_len, 1, &pce TSRMLS_CC) == FAILURE) { if (zend_u_lookup_class_ex(UG(unicode)?IS_UNICODE:IS_STRING, param->arg_info->class_name, param->arg_info->class_name_len, 1, &pce TSRMLS_CC) == FAILURE) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Class %v does not exist", param->arg_info->class_name); "Class %v does not exist", param->arg_info->class_name);
return; return;
} }
@ -1986,16 +1986,16 @@ ZEND_METHOD(reflection_parameter, getDefaultValue)
if (param->fptr->type != ZEND_USER_FUNCTION) if (param->fptr->type != ZEND_USER_FUNCTION)
{ {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Cannot determine default value for internal functions"); zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot determine default value for internal functions");
return; return;
} }
if (param->offset < param->required) { if (param->offset < param->required) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Parameter is not optional"); zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter is not optional");
return; return;
} }
precv = _get_recv_op((zend_op_array*)param->fptr, param->offset); precv = _get_recv_op((zend_op_array*)param->fptr, param->offset);
if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2.op_type == IS_UNUSED) { if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2.op_type == IS_UNUSED) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Internal error"); zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error");
return; return;
} }
@ -2010,7 +2010,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValue)
Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
ZEND_METHOD(reflection_method, export) ZEND_METHOD(reflection_method, export)
{ {
_reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_method_ptr), 2); _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_method_ptr, 2);
} }
/* }}} */ /* }}} */
@ -2057,7 +2057,7 @@ ZEND_METHOD(reflection_method, __construct)
case IS_STRING: case IS_STRING:
case IS_UNICODE: case IS_UNICODE:
if (zend_u_lookup_class(Z_TYPE_P(classname), Z_UNIVAL_P(classname), Z_UNILEN_P(classname), &pce TSRMLS_CC) == FAILURE) { if (zend_u_lookup_class(Z_TYPE_P(classname), Z_UNIVAL_P(classname), Z_UNILEN_P(classname), &pce TSRMLS_CC) == FAILURE) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Class %v does not exist", Z_UNIVAL_P(classname)); "Class %v does not exist", Z_UNIVAL_P(classname));
return; return;
} }
@ -2086,7 +2086,7 @@ ZEND_METHOD(reflection_method, __construct)
if (zend_u_hash_find(&ce->function_table, type, lcname, lcname_len + 1, (void **) &mptr) == FAILURE) { if (zend_u_hash_find(&ce->function_table, type, lcname, lcname_len + 1, (void **) &mptr) == FAILURE) {
efree(lcname); efree(lcname);
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Method %v::%R() does not exist", ce->name, type, name_str); "Method %v::%R() does not exist", ce->name, type, name_str);
return; return;
} }
@ -2144,11 +2144,11 @@ ZEND_METHOD(reflection_method, invoke)
if (!(mptr->common.fn_flags & ZEND_ACC_PUBLIC) || if (!(mptr->common.fn_flags & ZEND_ACC_PUBLIC) ||
(mptr->common.fn_flags & ZEND_ACC_ABSTRACT)) { (mptr->common.fn_flags & ZEND_ACC_ABSTRACT)) {
if (mptr->common.fn_flags & ZEND_ACC_ABSTRACT) { if (mptr->common.fn_flags & ZEND_ACC_ABSTRACT) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Trying to invoke abstract method %v::%v()", "Trying to invoke abstract method %v::%v()",
mptr->common.scope->name, mptr->common.function_name); mptr->common.scope->name, mptr->common.function_name);
} else { } else {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Trying to invoke %s method %v::%v() from scope %v", "Trying to invoke %s method %v::%v() from scope %v",
mptr->common.fn_flags & ZEND_ACC_PROTECTED ? "protected" : "private", mptr->common.fn_flags & ZEND_ACC_PROTECTED ? "protected" : "private",
mptr->common.scope->name, mptr->common.function_name, mptr->common.scope->name, mptr->common.function_name,
@ -2209,7 +2209,7 @@ ZEND_METHOD(reflection_method, invoke)
efree(params); efree(params);
if (result == FAILURE) { if (result == FAILURE) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Invocation of method %v::%v() failed", mptr->common.scope->name, mptr->common.function_name); "Invocation of method %v::%v() failed", mptr->common.scope->name, mptr->common.function_name);
return; return;
} }
@ -2247,11 +2247,11 @@ ZEND_METHOD(reflection_method, invokeArgs)
if (!(mptr->common.fn_flags & ZEND_ACC_PUBLIC) || if (!(mptr->common.fn_flags & ZEND_ACC_PUBLIC) ||
(mptr->common.fn_flags & ZEND_ACC_ABSTRACT)) { (mptr->common.fn_flags & ZEND_ACC_ABSTRACT)) {
if (mptr->common.fn_flags & ZEND_ACC_ABSTRACT) { if (mptr->common.fn_flags & ZEND_ACC_ABSTRACT) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Trying to invoke abstract method %v::%v", "Trying to invoke abstract method %v::%v",
mptr->common.scope->name, mptr->common.function_name); mptr->common.scope->name, mptr->common.function_name);
} else { } else {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Trying to invoke %s method %v::%v from scope %v", "Trying to invoke %s method %v::%v from scope %v",
mptr->common.fn_flags & ZEND_ACC_PROTECTED ? "protected" : "private", mptr->common.fn_flags & ZEND_ACC_PROTECTED ? "protected" : "private",
mptr->common.scope->name, mptr->common.function_name, mptr->common.scope->name, mptr->common.function_name,
@ -2278,7 +2278,7 @@ ZEND_METHOD(reflection_method, invokeArgs)
} else { } else {
if (!object) { if (!object) {
efree(params); efree(params);
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Trying to invoke non static method %v::%v without an object", "Trying to invoke non static method %v::%v without an object",
mptr->common.scope->name, mptr->common.function_name); mptr->common.scope->name, mptr->common.function_name);
return; return;
@ -2313,7 +2313,7 @@ ZEND_METHOD(reflection_method, invokeArgs)
efree(params); efree(params);
if (result == FAILURE) { if (result == FAILURE) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Invocation of method %v::%v() failed", mptr->common.scope->name, mptr->common.function_name); "Invocation of method %v::%v() failed", mptr->common.scope->name, mptr->common.function_name);
return; return;
} }
@ -2440,7 +2440,7 @@ ZEND_METHOD(reflection_method, getPrototype)
GET_REFLECTION_OBJECT_PTR(mptr); GET_REFLECTION_OBJECT_PTR(mptr);
if (!mptr->common.prototype) { if (!mptr->common.prototype) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Method %v::%v does not have a prototype", intern->ce->name, mptr->common.function_name); "Method %v::%v does not have a prototype", intern->ce->name, mptr->common.function_name);
return; return;
} }
@ -2453,7 +2453,7 @@ ZEND_METHOD(reflection_method, getPrototype)
Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
ZEND_METHOD(reflection_class, export) ZEND_METHOD(reflection_class, export)
{ {
_reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_class_ptr), 1); _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_class_ptr, 1);
} }
/* }}} */ /* }}} */
@ -2495,7 +2495,7 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob
convert_to_string_ex(&argument); 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 (zend_u_lookup_class(Z_TYPE_P(argument), Z_UNIVAL_P(argument), Z_UNILEN_P(argument), &ce TSRMLS_CC) == FAILURE) {
if (!EG(exception)) { if (!EG(exception)) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), -1 TSRMLS_CC, "Class %R does not exist", Z_TYPE_P(argument), Z_UNIVAL_P(argument)); zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %R does not exist", Z_TYPE_P(argument), Z_UNIVAL_P(argument));
} }
return; return;
} }
@ -2559,7 +2559,7 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue)
if (def_value) { if (def_value) {
RETURN_ZVAL(def_value, 1, 0); RETURN_ZVAL(def_value, 1, 0);
} else { } else {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Class %v does not have a property named %R", ce->name, name_type, name); "Class %v does not have a property named %R", ce->name, name_type, name);
} }
return; return;
@ -2591,7 +2591,7 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue)
zend_update_class_constants(ce TSRMLS_CC); zend_update_class_constants(ce TSRMLS_CC);
variable_ptr = zend_std_get_static_property(ce, name_type, name, name_len, 1 TSRMLS_CC); variable_ptr = zend_std_get_static_property(ce, name_type, name, name_len, 1 TSRMLS_CC);
if (!variable_ptr) { if (!variable_ptr) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Class %v does not have a property named %R", ce->name, name_type, name); "Class %v does not have a property named %R", ce->name, name_type, name);
return; return;
} }
@ -2837,7 +2837,7 @@ ZEND_METHOD(reflection_class, getMethod)
efree(lc_name); efree(lc_name);
} else { } else {
efree(lc_name); efree(lc_name);
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Method %R does not exist", type, name); "Method %R does not exist", type, name);
return; return;
} }
@ -2952,7 +2952,7 @@ ZEND_METHOD(reflection_class, getProperty)
if (zend_u_lookup_class(name_type, classname, classname_len, &pce TSRMLS_CC) == FAILURE) { if (zend_u_lookup_class(name_type, classname, classname_len, &pce TSRMLS_CC) == FAILURE) {
if (!EG(exception)) { if (!EG(exception)) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), -1 TSRMLS_CC, "Class %R does not exist", name_type, classname); zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %R does not exist", name_type, classname);
} }
efree(classname); efree(classname);
return; return;
@ -2960,7 +2960,7 @@ ZEND_METHOD(reflection_class, getProperty)
efree(classname); efree(classname);
if (!instanceof_function(ce, *pce TSRMLS_CC)) { if (!instanceof_function(ce, *pce TSRMLS_CC)) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), -1 TSRMLS_CC, "Fully qualified property name %v::%R does not specify a base class of %v", (*pce)->name, name_type, name, ce->name); zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Fully qualified property name %v::%R does not specify a base class of %v", (*pce)->name, name_type, name, ce->name);
return; return;
} }
ce = *pce; ce = *pce;
@ -2970,7 +2970,7 @@ ZEND_METHOD(reflection_class, getProperty)
return; return;
} }
} }
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Property %R does not exist", name_type, name); "Property %R does not exist", name_type, name);
} }
/* }}} */ /* }}} */
@ -3196,7 +3196,7 @@ ZEND_METHOD(reflection_class, newInstance)
zend_fcall_info_cache fcc; zend_fcall_info_cache fcc;
if (!(ce->constructor->common.fn_flags & ZEND_ACC_PUBLIC)) { if (!(ce->constructor->common.fn_flags & ZEND_ACC_PUBLIC)) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Access to non-public constructor of class %v", ce->name); zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Access to non-public constructor of class %v", ce->name);
return; return;
} }
@ -3236,7 +3236,7 @@ ZEND_METHOD(reflection_class, newInstance)
} else if (!ZEND_NUM_ARGS()) { } else if (!ZEND_NUM_ARGS()) {
object_init_ex(return_value, ce); object_init_ex(return_value, ce);
} else { } else {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Class %v does not have a constructor, so you cannot pass any constructor arguments", ce->name); zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %v does not have a constructor, so you cannot pass any constructor arguments", ce->name);
} }
} }
/* }}} */ /* }}} */
@ -3267,7 +3267,7 @@ ZEND_METHOD(reflection_class, newInstanceArgs)
zend_fcall_info_cache fcc; zend_fcall_info_cache fcc;
if (!(ce->constructor->common.fn_flags & ZEND_ACC_PUBLIC)) { if (!(ce->constructor->common.fn_flags & ZEND_ACC_PUBLIC)) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Access to non-public constructor of class %v", ce->name); zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Access to non-public constructor of class %v", ce->name);
return; return;
} }
@ -3305,7 +3305,7 @@ ZEND_METHOD(reflection_class, newInstanceArgs)
} else if (!ZEND_NUM_ARGS()) { } else if (!ZEND_NUM_ARGS()) {
object_init_ex(return_value, ce); object_init_ex(return_value, ce);
} else { } else {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Class %v does not have a constructor, so you cannot pass any constructor arguments", ce->name); zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %v does not have a constructor, so you cannot pass any constructor arguments", ce->name);
} }
} }
/* }}} */ /* }}} */
@ -3373,14 +3373,14 @@ ZEND_METHOD(reflection_class, isSubclassOf)
case IS_STRING: case IS_STRING:
case IS_UNICODE: 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) { if (zend_u_lookup_class(Z_TYPE_P(class_name), Z_UNIVAL_P(class_name), Z_UNILEN_P(class_name), &pce TSRMLS_CC) == FAILURE) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Interface %R does not exist", Z_TYPE_P(class_name), Z_UNIVAL_P(class_name)); "Interface %R does not exist", Z_TYPE_P(class_name), Z_UNIVAL_P(class_name));
return; return;
} }
class_ce = *pce; class_ce = *pce;
break; break;
case IS_OBJECT: case IS_OBJECT:
if (instanceof_function(Z_OBJCE_P(class_name), U_CLASS_ENTRY(reflection_class_ptr) TSRMLS_CC)) { if (instanceof_function(Z_OBJCE_P(class_name), reflection_class_ptr TSRMLS_CC)) {
argument = (reflection_object *) zend_object_store_get_object(class_name TSRMLS_CC); argument = (reflection_object *) zend_object_store_get_object(class_name TSRMLS_CC);
if (argument == NULL || argument->ptr == NULL) { if (argument == NULL || argument->ptr == NULL) {
zend_error(E_ERROR, "Internal error: Failed to retrieve the argument's reflection object"); zend_error(E_ERROR, "Internal error: Failed to retrieve the argument's reflection object");
@ -3391,7 +3391,7 @@ ZEND_METHOD(reflection_class, isSubclassOf)
} }
/* no break */ /* no break */
default: default:
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Parameter one must either be a string or a ReflectionClass object"); "Parameter one must either be a string or a ReflectionClass object");
return; return;
} }
@ -3420,14 +3420,14 @@ ZEND_METHOD(reflection_class, implementsInterface)
case IS_STRING: case IS_STRING:
case IS_UNICODE: case IS_UNICODE:
if (zend_u_lookup_class(Z_TYPE_P(interface), Z_UNIVAL_P(interface), Z_UNILEN_P(interface), &pce TSRMLS_CC) == FAILURE) { if (zend_u_lookup_class(Z_TYPE_P(interface), Z_UNIVAL_P(interface), Z_UNILEN_P(interface), &pce TSRMLS_CC) == FAILURE) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Interface %R does not exist", Z_TYPE_P(interface), Z_UNIVAL_P(interface)); "Interface %R does not exist", Z_TYPE_P(interface), Z_UNIVAL_P(interface));
return; return;
} }
interface_ce = *pce; interface_ce = *pce;
break; break;
case IS_OBJECT: case IS_OBJECT:
if (instanceof_function(Z_OBJCE_P(interface), U_CLASS_ENTRY(reflection_class_ptr) TSRMLS_CC)) { if (instanceof_function(Z_OBJCE_P(interface), reflection_class_ptr TSRMLS_CC)) {
argument = (reflection_object *) zend_object_store_get_object(interface TSRMLS_CC); argument = (reflection_object *) zend_object_store_get_object(interface TSRMLS_CC);
if (argument == NULL || argument->ptr == NULL) { if (argument == NULL || argument->ptr == NULL) {
zend_error(E_ERROR, "Internal error: Failed to retrieve the argument's reflection object"); zend_error(E_ERROR, "Internal error: Failed to retrieve the argument's reflection object");
@ -3438,13 +3438,13 @@ ZEND_METHOD(reflection_class, implementsInterface)
} }
/* no break */ /* no break */
default: default:
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Parameter one must either be a string or a ReflectionClass object"); "Parameter one must either be a string or a ReflectionClass object");
return; return;
} }
if (!(interface_ce->ce_flags & ZEND_ACC_INTERFACE)) { if (!(interface_ce->ce_flags & ZEND_ACC_INTERFACE)) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Interface %v is a Class", interface_ce->name); "Interface %v is a Class", interface_ce->name);
return; return;
} }
@ -3504,7 +3504,7 @@ ZEND_METHOD(reflection_class, getExtensionName)
Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
ZEND_METHOD(reflection_object, export) ZEND_METHOD(reflection_object, export)
{ {
_reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_object_ptr), 1); _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_object_ptr, 1);
} }
/* }}} */ /* }}} */
@ -3520,7 +3520,7 @@ ZEND_METHOD(reflection_object, __construct)
Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
ZEND_METHOD(reflection_property, export) ZEND_METHOD(reflection_property, export)
{ {
_reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_property_ptr), 2); _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_property_ptr, 2);
} }
/* }}} */ /* }}} */
@ -3554,7 +3554,7 @@ ZEND_METHOD(reflection_property, __construct)
case IS_STRING: case IS_STRING:
case IS_UNICODE: case IS_UNICODE:
if (zend_u_lookup_class(Z_TYPE_P(classname), Z_UNIVAL_P(classname), Z_UNILEN_P(classname), &pce TSRMLS_CC) == FAILURE) { if (zend_u_lookup_class(Z_TYPE_P(classname), Z_UNIVAL_P(classname), Z_UNILEN_P(classname), &pce TSRMLS_CC) == FAILURE) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Class %R does not exist", Z_TYPE_P(classname), Z_UNIVAL_P(classname)); "Class %R does not exist", Z_TYPE_P(classname), Z_UNIVAL_P(classname));
return; return;
} }
@ -3571,7 +3571,7 @@ ZEND_METHOD(reflection_property, __construct)
} }
if (zend_u_hash_find(&ce->properties_info, name_type, name_str, name_len + 1, (void **) &property_info) == FAILURE || (property_info->flags & ZEND_ACC_SHADOW)) { if (zend_u_hash_find(&ce->properties_info, name_type, name_str, name_len + 1, (void **) &property_info) == FAILURE || (property_info->flags & ZEND_ACC_SHADOW)) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Property %v::$%R does not exist", ce->name, name_type, name_str); "Property %v::$%R does not exist", ce->name, name_type, name_str);
return; return;
} }
@ -3839,7 +3839,7 @@ ZEND_METHOD(reflection_property, getDocComment)
Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
ZEND_METHOD(reflection_extension, export) ZEND_METHOD(reflection_extension, export)
{ {
_reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_extension_ptr), 1); _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_extension_ptr, 1);
} }
/* }}} */ /* }}} */
@ -3868,7 +3868,7 @@ ZEND_METHOD(reflection_extension, __construct)
zend_str_tolower_copy(lcname, name_str, name_len); zend_str_tolower_copy(lcname, name_str, name_len);
if (zend_hash_find(&module_registry, lcname, name_len + 1, (void **)&module) == FAILURE) { if (zend_hash_find(&module_registry, lcname, name_len + 1, (void **)&module) == FAILURE) {
free_alloca(lcname); free_alloca(lcname);
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Extension %s does not exist", name_str); "Extension %s does not exist", name_str);
return; return;
} }
@ -4248,7 +4248,7 @@ static void _reflection_write_property(zval *object, zval *member, zval *value T
&& (ZEND_U_EQUAL(Z_TYPE_P(member), Z_UNIVAL_P(member), Z_UNILEN_P(member), "name", sizeof("name")-1) || && (ZEND_U_EQUAL(Z_TYPE_P(member), Z_UNIVAL_P(member), Z_UNILEN_P(member), "name", sizeof("name")-1) ||
ZEND_U_EQUAL(Z_TYPE_P(member), Z_UNIVAL_P(member), Z_UNILEN_P(member), "class", sizeof("class")-1))) ZEND_U_EQUAL(Z_TYPE_P(member), Z_UNIVAL_P(member), Z_UNILEN_P(member), "class", sizeof("class")-1)))
{ {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Cannot set read-only property %v::$%R", Z_OBJCE_P(object)->name, Z_TYPE_P(member), Z_UNIVAL_P(member)); "Cannot set read-only property %v::$%R", Z_OBJCE_P(object)->name, Z_TYPE_P(member), Z_UNIVAL_P(member));
} }
else else

View file

@ -6,7 +6,7 @@ use_trans_sid should not affect SID
session.use_trans_sid=1 session.use_trans_sid=1
session.use_cookies=0 session.use_cookies=0
session.cache_limiter= session.cache_limiter=
arg_separator.output=& arg_separator.output="&"
session.name=PHPSESSID session.name=PHPSESSID
session.serialize_handler=php session.serialize_handler=php
session.save_handler=files session.save_handler=files

View file

@ -6,7 +6,7 @@ rewriter uses arg_seperator.output for modifying URLs
session.use_cookies=0 session.use_cookies=0
session.cache_limiter= session.cache_limiter=
session.use_trans_sid=1 session.use_trans_sid=1
arg_separator.output=&amp; arg_separator.output="&amp;"
session.name=PHPSESSID session.name=PHPSESSID
session.serialize_handler=php session.serialize_handler=php
session.save_handler=files session.save_handler=files

View file

@ -44,7 +44,7 @@ zend_class_entry *sxe_class_entry = NULL;
ZEND_API zend_class_entry *sxe_get_element_class_entry(TSRMLS_D) ZEND_API zend_class_entry *sxe_get_element_class_entry(TSRMLS_D)
{ {
return U_CLASS_ENTRY(sxe_class_entry); return sxe_class_entry;
} }
#define SXE_ME(func, arg_info, flags) PHP_ME(simplexml_element, func, arg_info, flags) #define SXE_ME(func, arg_info, flags) PHP_ME(simplexml_element, func, arg_info, flags)
@ -1585,7 +1585,7 @@ PHP_FUNCTION(simplexml_load_file)
char *classname = ""; char *classname = "";
int classname_len = 0; int classname_len = 0;
long options = 0; long options = 0;
zend_class_entry *ce= U_CLASS_ENTRY(sxe_class_entry); zend_class_entry *ce= sxe_class_entry;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sl", &filename, &filename_len, &classname, &classname_len, &options) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sl", &filename, &filename_len, &classname, &classname_len, &options) == FAILURE) {
return; return;
@ -1629,7 +1629,7 @@ PHP_FUNCTION(simplexml_load_string)
char *classname = ""; char *classname = "";
int classname_len = 0; int classname_len = 0;
long options = 0; long options = 0;
zend_class_entry *ce= U_CLASS_ENTRY(sxe_class_entry); zend_class_entry *ce= sxe_class_entry;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sl", &data, &data_len, &classname, &classname_len, &options) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sl", &data, &data_len, &classname, &classname_len, &options) == FAILURE) {
return; return;
@ -1896,7 +1896,7 @@ PHP_FUNCTION(simplexml_import_dom)
xmlNodePtr nodep = NULL; xmlNodePtr nodep = NULL;
char *classname = ""; char *classname = "";
int classname_len = 0; int classname_len = 0;
zend_class_entry *ce= U_CLASS_ENTRY(sxe_class_entry); zend_class_entry *ce= sxe_class_entry;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|s", &node, &classname, &classname_len) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|s", &node, &classname, &classname_len) == FAILURE) {
return; return;

View file

@ -145,7 +145,7 @@ PHP_FUNCTION(class_implements)
/* }}} */ /* }}} */
#define SPL_ADD_CLASS(class_name, z_list, sub, allow, ce_flags) \ #define SPL_ADD_CLASS(class_name, z_list, sub, allow, ce_flags) \
spl_add_classes(U_CLASS_ENTRY(spl_ce_ ## class_name), z_list, sub, allow, ce_flags TSRMLS_CC) spl_add_classes(spl_ce_ ## class_name, z_list, sub, allow, ce_flags TSRMLS_CC)
#define SPL_LIST_CLASSES(z_list, sub, allow, ce_flags) \ #define SPL_LIST_CLASSES(z_list, sub, allow, ce_flags) \
SPL_ADD_CLASS(AppendIterator, z_list, sub, allow, ce_flags); \ SPL_ADD_CLASS(AppendIterator, z_list, sub, allow, ce_flags); \
@ -298,7 +298,7 @@ PHP_FUNCTION(spl_autoload)
EG(function_state_ptr) = original_function_state_ptr; EG(function_state_ptr) = original_function_state_ptr;
if (!found) { if (!found) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Class %s could not be loaded", class_name); zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Class %s could not be loaded", class_name);
} }
} /* }}} */ } /* }}} */
@ -420,25 +420,25 @@ PHP_FUNCTION(spl_autoload_register)
if (Z_TYPE_P(zcallable) == IS_ARRAY) { if (Z_TYPE_P(zcallable) == IS_ARRAY) {
if (!obj_ptr && alfi.func_ptr && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) { if (!obj_ptr && alfi.func_ptr && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) {
if (do_throw) { if (do_throw) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Passed array specifies a non static method but no object"); zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Passed array specifies a non static method but no object");
} }
zval_dtor(&zfunc_name); zval_dtor(&zfunc_name);
return; return;
} }
else if (do_throw) { else if (do_throw) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Passed array does not specify %s %smethod", alfi.func_ptr ? "a callable" : "an existing", !obj_ptr ? "static " : ""); zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Passed array does not specify %s %smethod", alfi.func_ptr ? "a callable" : "an existing", !obj_ptr ? "static " : "");
} }
zval_dtor(&zfunc_name); zval_dtor(&zfunc_name);
return; return;
} else if (Z_TYPE_P(zcallable) == IS_STRING || Z_TYPE_P(zcallable) == IS_UNICODE) { } else if (Z_TYPE_P(zcallable) == IS_STRING || Z_TYPE_P(zcallable) == IS_UNICODE) {
if (do_throw) { if (do_throw) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Function '%R' not %s", Z_TYPE_P(zcallable), Z_UNIVAL_P(zcallable), alfi.func_ptr ? "callable" : "found"); zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Function '%R' not %s", Z_TYPE_P(zcallable), Z_UNIVAL_P(zcallable), alfi.func_ptr ? "callable" : "found");
} }
zval_dtor(&zfunc_name); zval_dtor(&zfunc_name);
return; return;
} else { } else {
if (do_throw) { if (do_throw) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Illegal value passed"); zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Illegal value passed");
} }
zval_dtor(&zfunc_name); zval_dtor(&zfunc_name);
return; return;

View file

@ -156,11 +156,11 @@ static zend_object_value spl_array_object_new_ex(zend_class_entry *class_type, s
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) spl_array_object_free_storage, NULL TSRMLS_CC); retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) spl_array_object_free_storage, NULL TSRMLS_CC);
while (parent) { while (parent) {
if (parent == U_CLASS_ENTRY(spl_ce_ArrayIterator) || parent == U_CLASS_ENTRY(spl_ce_RecursiveArrayIterator)) { if (parent == spl_ce_ArrayIterator || parent == spl_ce_RecursiveArrayIterator) {
retval.handlers = &spl_handler_ArrayIterator; retval.handlers = &spl_handler_ArrayIterator;
class_type->get_iterator = spl_array_get_iterator; class_type->get_iterator = spl_array_get_iterator;
break; break;
} else if (parent == U_CLASS_ENTRY(spl_ce_ArrayObject)) { } else if (parent == spl_ce_ArrayObject) {
retval.handlers = &spl_handler_ArrayObject; retval.handlers = &spl_handler_ArrayObject;
break; break;
} }
@ -207,7 +207,7 @@ static zend_object_value spl_array_object_new_ex(zend_class_entry *class_type, s
} }
} }
intern->ce_get_iterator = U_CLASS_ENTRY(spl_ce_ArrayIterator); intern->ce_get_iterator = spl_ce_ArrayIterator;
zend_hash_internal_pointer_reset_ex(spl_array_get_hash_table(intern, 0 TSRMLS_CC), &intern->pos); zend_hash_internal_pointer_reset_ex(spl_array_get_hash_table(intern, 0 TSRMLS_CC), &intern->pos);
return retval; return retval;
} }
@ -332,7 +332,7 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval
case IS_STRING: case IS_STRING:
case IS_UNICODE: case IS_UNICODE:
if (*(char*)Z_UNIVAL_P(offset) == '\0') { if (*(char*)Z_UNIVAL_P(offset) == '\0') {
zend_throw_exception(U_CLASS_ENTRY(spl_ce_InvalidArgumentException), "An offset must not begin with \\0 or be empty", 0 TSRMLS_CC); zend_throw_exception(spl_ce_InvalidArgumentException, "An offset must not begin with \\0 or be empty", 0 TSRMLS_CC);
return; return;
} }
value->refcount++; value->refcount++;
@ -845,7 +845,7 @@ SPL_METHOD(Array, __construct)
if (ZEND_NUM_ARGS() == 0) { if (ZEND_NUM_ARGS() == 0) {
return; /* nothing to do */ return; /* nothing to do */
} }
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_InvalidArgumentException) TSRMLS_CC); php_set_error_handling(EH_THROW, spl_ce_InvalidArgumentException TSRMLS_CC);
intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
@ -856,7 +856,7 @@ SPL_METHOD(Array, __construct)
if (ZEND_NUM_ARGS() > 2) { if (ZEND_NUM_ARGS() > 2) {
if (zend_lookup_class(class_name, class_name_len, &pce_get_iterator TSRMLS_CC) == FAILURE) { if (zend_lookup_class(class_name, class_name_len, &pce_get_iterator TSRMLS_CC) == FAILURE) {
zend_throw_exception(U_CLASS_ENTRY(spl_ce_InvalidArgumentException), "A class that implements Iterator must be specified", 0 TSRMLS_CC); zend_throw_exception(spl_ce_InvalidArgumentException, "A class that implements Iterator must be specified", 0 TSRMLS_CC);
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
return; return;
} }
@ -877,7 +877,7 @@ SPL_METHOD(Array, __construct)
} else { } else {
if (Z_TYPE_P(array) != IS_OBJECT && Z_TYPE_P(array) != IS_ARRAY) { if (Z_TYPE_P(array) != IS_OBJECT && Z_TYPE_P(array) != IS_ARRAY) {
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
zend_throw_exception(U_CLASS_ENTRY(spl_ce_InvalidArgumentException), "Passed variable is not an array or object, using empty array instead", 0 TSRMLS_CC); zend_throw_exception(spl_ce_InvalidArgumentException, "Passed variable is not an array or object, using empty array instead", 0 TSRMLS_CC);
return; return;
} }
zval_ptr_dtor(&intern->array); zval_ptr_dtor(&intern->array);
@ -895,7 +895,7 @@ SPL_METHOD(Array, __construct)
if ((handler != std_object_handlers.get_properties && handler != spl_array_get_properties) if ((handler != std_object_handlers.get_properties && handler != spl_array_get_properties)
|| !spl_array_get_hash_table(intern, 0 TSRMLS_CC)) { || !spl_array_get_hash_table(intern, 0 TSRMLS_CC)) {
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_InvalidArgumentException), 0 TSRMLS_CC, "Overloaded object of type %s is not compatible with %s", Z_OBJCE_P(array)->name, intern->std.ce->name); zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Overloaded object of type %s is not compatible with %s", Z_OBJCE_P(array)->name, intern->std.ce->name);
return; return;
} }
} }
@ -922,7 +922,7 @@ SPL_METHOD(Array, setIteratorClass)
} }
if (zend_lookup_class(class_name, class_name_len, &pce_get_iterator TSRMLS_CC) == FAILURE) { if (zend_lookup_class(class_name, class_name_len, &pce_get_iterator TSRMLS_CC) == FAILURE) {
zend_throw_exception(U_CLASS_ENTRY(spl_ce_InvalidArgumentException), "A class that implements Iterator must be specified", 0 TSRMLS_CC); zend_throw_exception(spl_ce_InvalidArgumentException, "A class that implements Iterator must be specified", 0 TSRMLS_CC);
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
return; return;
} }
@ -992,7 +992,7 @@ SPL_METHOD(Array, exchangeArray)
intern->array = other->array; intern->array = other->array;
} else { } else {
if (Z_TYPE_PP(array) != IS_OBJECT && !HASH_OF(*array)) { if (Z_TYPE_PP(array) != IS_OBJECT && !HASH_OF(*array)) {
zend_throw_exception(U_CLASS_ENTRY(spl_ce_InvalidArgumentException), "Passed variable is not an array or object, using empty array instead", 0 TSRMLS_CC); zend_throw_exception(spl_ce_InvalidArgumentException, "Passed variable is not an array or object, using empty array instead", 0 TSRMLS_CC);
return; return;
} }
zval_ptr_dtor(&intern->array); zval_ptr_dtor(&intern->array);
@ -1072,7 +1072,7 @@ SPL_METHOD(Array, seek)
return; /* ok */ return; /* ok */
} }
} }
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_OutOfBoundsException), 0 TSRMLS_CC, "Seek position %ld is out of range", opos); zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Seek position %ld is out of range", opos);
} /* }}} */ } /* }}} */
int spl_array_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */ int spl_array_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */
@ -1127,7 +1127,7 @@ static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fnam
if (use_arg) { if (use_arg) {
if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) { if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) {
zend_throw_exception(U_CLASS_ENTRY(spl_ce_BadMethodCallException), "Function expects exactly one argument", 0 TSRMLS_CC); zend_throw_exception(spl_ce_BadMethodCallException, "Function expects exactly one argument", 0 TSRMLS_CC);
return; return;
} }
zend_call_method(NULL, NULL, NULL, fname, fname_len, &return_value, 2, &tmp, arg TSRMLS_CC); zend_call_method(NULL, NULL, NULL, fname, fname_len, &return_value, 2, &tmp, arg TSRMLS_CC);

View file

@ -131,8 +131,8 @@ static zend_object_value spl_filesystem_object_new_ex(zend_class_entry *class_ty
memset(intern, 0, sizeof(spl_filesystem_object)); memset(intern, 0, sizeof(spl_filesystem_object));
intern->std.ce = class_type; intern->std.ce = class_type;
/* intern->type = SPL_FS_INFO; done by set o */ /* intern->type = SPL_FS_INFO; done by set o */
intern->file_class = U_CLASS_ENTRY(spl_ce_SplFileObject); intern->file_class = spl_ce_SplFileObject;
intern->info_class = U_CLASS_ENTRY(spl_ce_SplFileInfo); intern->info_class = spl_ce_SplFileInfo;
if (obj) *obj = intern; if (obj) *obj = intern;
ALLOC_HASHTABLE(intern->std.properties); ALLOC_HASHTABLE(intern->std.properties);
@ -206,7 +206,7 @@ static int spl_filesystem_file_open(spl_filesystem_object *intern, int use_inclu
if (intern->u.file.stream == NULL) { if (intern->u.file.stream == NULL) {
if (!EG(exception)) { if (!EG(exception)) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, "Cannot open file %s", intern->file_name); zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot open file %s", intern->file_name);
} }
intern->file_name = NULL; /* until here it is not a copy */ intern->file_name = NULL; /* until here it is not a copy */
intern->u.file.open_mode = NULL; intern->u.file.open_mode = NULL;
@ -301,7 +301,7 @@ static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_
spl_filesystem_object *intern; spl_filesystem_object *intern;
if (!file_path || !file_path_len) { if (!file_path || !file_path_len) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, "Cannot create SplFileInfo for empty path"); zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot create SplFileInfo for empty path");
if (file_path && !use_copy) if (file_path && !use_copy)
{ {
efree(file_path); efree(file_path);
@ -309,7 +309,7 @@ static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_
return NULL; return NULL;
} }
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_RuntimeException) TSRMLS_CC); php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC);
return_value->value.obj = spl_filesystem_object_new_ex(ce ? ce : source->info_class, &intern TSRMLS_CC); return_value->value.obj = spl_filesystem_object_new_ex(ce ? ce : source->info_class, &intern TSRMLS_CC);
Z_TYPE_P(return_value) = IS_OBJECT; Z_TYPE_P(return_value) = IS_OBJECT;
@ -326,7 +326,7 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil
spl_filesystem_object *intern; spl_filesystem_object *intern;
zend_bool use_include_path = 0; zend_bool use_include_path = 0;
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_RuntimeException) TSRMLS_CC); php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC);
switch (source->type) { switch (source->type) {
case SPL_FS_INFO: case SPL_FS_INFO:
@ -334,7 +334,7 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil
break; break;
case SPL_FS_DIR: case SPL_FS_DIR:
if (!source->u.dir.entry.d_name[0]) { if (!source->u.dir.entry.d_name[0]) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, "Could not open file"); zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Could not open file");
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
return NULL; return NULL;
} }
@ -381,7 +381,7 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil
break; break;
case SPL_FS_DIR: case SPL_FS_DIR:
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, "Operation not supported"); zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Operation not supported");
return NULL; return NULL;
} }
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
@ -396,7 +396,7 @@ SPL_METHOD(DirectoryIterator, __construct)
char *path; char *path;
int len; int len;
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_RuntimeException) TSRMLS_CC); php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &len) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &len) == FAILURE) {
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
@ -411,7 +411,7 @@ SPL_METHOD(DirectoryIterator, __construct)
intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
spl_filesystem_dir_open(intern, path TSRMLS_CC); spl_filesystem_dir_open(intern, path TSRMLS_CC);
intern->u.dir.is_recursive = instanceof_function(intern->std.ce, U_CLASS_ENTRY(spl_ce_RecursiveDirectoryIterator) TSRMLS_CC) ? 1 : 0; intern->u.dir.is_recursive = instanceof_function(intern->std.ce, spl_ce_RecursiveDirectoryIterator TSRMLS_CC) ? 1 : 0;
intern->flags = 0; intern->flags = 0;
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
@ -596,7 +596,7 @@ SPL_METHOD(SplFileInfo, __construct)
char *path; char *path;
int len; int len;
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_RuntimeException) TSRMLS_CC); php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &len) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &len) == FAILURE) {
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
@ -714,7 +714,7 @@ SPL_METHOD(SplFileInfo, openFile)
SPL_METHOD(SplFileInfo, setFileClass) SPL_METHOD(SplFileInfo, setFileClass)
{ {
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
zend_class_entry *ce = U_CLASS_ENTRY(spl_ce_SplFileObject); zend_class_entry *ce = spl_ce_SplFileObject;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) == FAILURE) {
return; return;
@ -729,7 +729,7 @@ SPL_METHOD(SplFileInfo, setFileClass)
SPL_METHOD(SplFileInfo, setInfoClass) SPL_METHOD(SplFileInfo, setInfoClass)
{ {
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
zend_class_entry *ce = U_CLASS_ENTRY(spl_ce_SplFileInfo); zend_class_entry *ce = spl_ce_SplFileInfo;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) == FAILURE) {
return; return;
@ -778,7 +778,7 @@ SPL_METHOD(RecursiveDirectoryIterator, __construct)
int len; int len;
long flags = SPL_FILE_DIR_CURRENT_AS_FILEINFO; long flags = SPL_FILE_DIR_CURRENT_AS_FILEINFO;
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_RuntimeException) TSRMLS_CC); php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &len, &flags) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &len, &flags) == FAILURE) {
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
@ -787,7 +787,7 @@ SPL_METHOD(RecursiveDirectoryIterator, __construct)
intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
spl_filesystem_dir_open(intern, path TSRMLS_CC); spl_filesystem_dir_open(intern, path TSRMLS_CC);
intern->u.dir.is_recursive = instanceof_function(intern->std.ce, U_CLASS_ENTRY(spl_ce_RecursiveDirectoryIterator) TSRMLS_CC) ? 1 : 0; intern->u.dir.is_recursive = instanceof_function(intern->std.ce, spl_ce_RecursiveDirectoryIterator TSRMLS_CC) ? 1 : 0;
intern->flags = flags; intern->flags = flags;
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
@ -869,7 +869,7 @@ SPL_METHOD(RecursiveDirectoryIterator, getChildren)
INIT_PZVAL(&zpath); INIT_PZVAL(&zpath);
ZVAL_STRINGL(&zpath, intern->file_name, intern->file_name_len, 0); ZVAL_STRINGL(&zpath, intern->file_name, intern->file_name_len, 0);
spl_instantiate_arg_ex1(U_CLASS_ENTRY(spl_ce_RecursiveDirectoryIterator), &return_value, 0, &zpath TSRMLS_CC); spl_instantiate_arg_ex1(spl_ce_RecursiveDirectoryIterator, &return_value, 0, &zpath TSRMLS_CC);
subdir = (spl_filesystem_object*)zend_object_store_get_object(return_value TSRMLS_CC); subdir = (spl_filesystem_object*)zend_object_store_get_object(return_value TSRMLS_CC);
if (subdir) { if (subdir) {
@ -1317,7 +1317,7 @@ static int spl_filesystem_file_read(spl_filesystem_object *intern, int silent TS
if (php_stream_eof(intern->u.file.stream)) { if (php_stream_eof(intern->u.file.stream)) {
if (!silent) { if (!silent) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, "Cannot read from file %s", intern->file_name); zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot read from file %s", intern->file_name);
} }
return FAILURE; return FAILURE;
} }
@ -1351,10 +1351,10 @@ static int spl_filesystem_file_read_line(zval * this_ptr, spl_filesystem_object
zval *retval; zval *retval;
/* if overloaded call the function, otherwise do it directly */ /* if overloaded call the function, otherwise do it directly */
if (intern->u.file.func_getCurr->common.scope != U_CLASS_ENTRY(spl_ce_SplFileObject)) { if (intern->u.file.func_getCurr->common.scope != spl_ce_SplFileObject) {
if (php_stream_eof(intern->u.file.stream)) { if (php_stream_eof(intern->u.file.stream)) {
if (!silent) { if (!silent) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, "Cannot read from file %s", intern->file_name); zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot read from file %s", intern->file_name);
} }
return FAILURE; return FAILURE;
} }
@ -1384,7 +1384,7 @@ static int spl_filesystem_file_read_line(zval * this_ptr, spl_filesystem_object
static void spl_filesystem_file_rewind(spl_filesystem_object *intern TSRMLS_DC) /* {{{ */ static void spl_filesystem_file_rewind(spl_filesystem_object *intern TSRMLS_DC) /* {{{ */
{ {
if (-1 == php_stream_rewind(intern->u.file.stream)) { if (-1 == php_stream_rewind(intern->u.file.stream)) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, "Cannot rewind file %s", intern->file_name); zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot rewind file %s", intern->file_name);
} else { } else {
spl_filesystem_file_free_line(intern TSRMLS_CC); spl_filesystem_file_free_line(intern TSRMLS_CC);
intern->u.file.current_line_num = 0; intern->u.file.current_line_num = 0;
@ -1399,7 +1399,7 @@ SPL_METHOD(SplFileObject, __construct)
zend_bool use_include_path = 0; zend_bool use_include_path = 0;
char *p1, *p2; char *p1, *p2;
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_RuntimeException) TSRMLS_CC); php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC);
intern->u.file.open_mode = "r"; intern->u.file.open_mode = "r";
intern->u.file.open_mode_len = 1; intern->u.file.open_mode_len = 1;
@ -1438,7 +1438,7 @@ SPL_METHOD(SplTempFileObject, __construct)
char tmp_fname[48]; char tmp_fname[48];
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_RuntimeException) TSRMLS_CC); php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &max_memory) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &max_memory) == FAILURE) {
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
@ -1586,7 +1586,7 @@ SPL_METHOD(SplFileObject, setMaxLineLen)
} }
if (max_len < 0) { if (max_len < 0) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_DomainException), 0 TSRMLS_CC, "Maximum line length must be greater than or equal zero"); zend_throw_exception_ex(spl_ce_DomainException, 0 TSRMLS_CC, "Maximum line length must be greater than or equal zero");
return; return;
} }
@ -1850,7 +1850,7 @@ SPL_METHOD(SplFileObject, ftruncate)
} }
if (!php_stream_truncate_supported(intern->u.file.stream)) { if (!php_stream_truncate_supported(intern->u.file.stream)) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Can't truncate file %s", intern->file_name); zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Can't truncate file %s", intern->file_name);
RETURN_FALSE; RETURN_FALSE;
} }
@ -1868,7 +1868,7 @@ SPL_METHOD(SplFileObject, seek)
return; return;
} }
if (line_pos < 0) { if (line_pos < 0) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "Can't seek file %s to negative line %ld", intern->file_name, line_pos); zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Can't seek file %s to negative line %ld", intern->file_name, line_pos);
RETURN_FALSE; RETURN_FALSE;
} }

View file

@ -265,11 +265,11 @@ next_step:
} }
ce = child && Z_TYPE_P(child) == IS_OBJECT ? Z_OBJCE_P(child) : NULL; ce = child && Z_TYPE_P(child) == IS_OBJECT ? Z_OBJCE_P(child) : NULL;
if (!ce || !instanceof_function(ce, U_CLASS_ENTRY(spl_ce_RecursiveIterator) TSRMLS_CC)) { if (!ce || !instanceof_function(ce, spl_ce_RecursiveIterator TSRMLS_CC)) {
if (child) { if (child) {
zval_ptr_dtor(&child); zval_ptr_dtor(&child);
} }
zend_throw_exception(U_CLASS_ENTRY(spl_ce_UnexpectedValueException), "Objects returned by RecursiveIterator::getChildren() must implement RecursiveIterator", 0 TSRMLS_CC); zend_throw_exception(spl_ce_UnexpectedValueException, "Objects returned by RecursiveIterator::getChildren() must implement RecursiveIterator", 0 TSRMLS_CC);
return; return;
} }
if (object->mode == RIT_CHILD_FIRST) { if (object->mode == RIT_CHILD_FIRST) {
@ -313,7 +313,7 @@ static void spl_recursive_it_rewind_ex(spl_recursive_it_object *object, zval *zt
sub_iter = object->iterators[object->level].iterator; sub_iter = object->iterators[object->level].iterator;
sub_iter->funcs->dtor(sub_iter TSRMLS_CC); sub_iter->funcs->dtor(sub_iter TSRMLS_CC);
zval_ptr_dtor(&object->iterators[object->level--].zobject); zval_ptr_dtor(&object->iterators[object->level--].zobject);
if (!object->endChildren || object->endChildren->common.scope != U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { if (!object->endChildren || object->endChildren->common.scope != spl_ce_RecursiveIteratorIterator) {
zend_call_method_with_0_params(&zthis, object->ce, &object->endChildren, "endchildren", NULL); zend_call_method_with_0_params(&zthis, object->ce, &object->endChildren, "endchildren", NULL);
} }
} }
@ -378,10 +378,10 @@ SPL_METHOD(RecursiveIteratorIterator, __construct)
long mode = RIT_LEAVES_ONLY, flags = 0; long mode = RIT_LEAVES_ONLY, flags = 0;
int inc_refcount = 1; int inc_refcount = 1;
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_InvalidArgumentException) TSRMLS_CC); php_set_error_handling(EH_THROW, spl_ce_InvalidArgumentException TSRMLS_CC);
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|ll", &iterator, &mode, &flags) == SUCCESS) { if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|ll", &iterator, &mode, &flags) == SUCCESS) {
if (instanceof_function(Z_OBJCE_P(iterator), U_CLASS_ENTRY(zend_ce_aggregate) TSRMLS_CC)) { if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate TSRMLS_CC)) {
zval *aggregate = iterator; 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); zend_call_method_with_0_params(&aggregate, Z_OBJCE_P(aggregate), &Z_OBJCE_P(aggregate)->iterator_funcs.zf_new_iterator, "getiterator", &iterator);
inc_refcount = 0; inc_refcount = 0;
@ -389,12 +389,12 @@ SPL_METHOD(RecursiveIteratorIterator, __construct)
} else { } else {
iterator = NULL; iterator = NULL;
} }
if (!iterator || !instanceof_function(Z_OBJCE_P(iterator), U_CLASS_ENTRY(spl_ce_RecursiveIterator) TSRMLS_CC)) { if (!iterator || !instanceof_function(Z_OBJCE_P(iterator), spl_ce_RecursiveIterator TSRMLS_CC)) {
if (iterator && !inc_refcount) { if (iterator && !inc_refcount) {
zval_ptr_dtor(&iterator); zval_ptr_dtor(&iterator);
} }
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
zend_throw_exception(U_CLASS_ENTRY(spl_ce_InvalidArgumentException), "An instance of RecursiveIterator or IteratorAggregate creating it is required", 0 TSRMLS_CC); zend_throw_exception(spl_ce_InvalidArgumentException, "An instance of RecursiveIterator or IteratorAggregate creating it is required", 0 TSRMLS_CC);
return; return;
} }
@ -408,31 +408,31 @@ SPL_METHOD(RecursiveIteratorIterator, __construct)
intern->ce = Z_OBJCE_P(object); intern->ce = Z_OBJCE_P(object);
zend_hash_find(&intern->ce->function_table, "beginiteration", sizeof("beginiteration"), (void **) &intern->beginIteration); zend_hash_find(&intern->ce->function_table, "beginiteration", sizeof("beginiteration"), (void **) &intern->beginIteration);
if (intern->beginIteration->common.scope == U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { if (intern->beginIteration->common.scope == spl_ce_RecursiveIteratorIterator) {
intern->beginIteration = NULL; intern->beginIteration = NULL;
} }
zend_hash_find(&intern->ce->function_table, "enditeration", sizeof("enditeration"), (void **) &intern->endIteration); zend_hash_find(&intern->ce->function_table, "enditeration", sizeof("enditeration"), (void **) &intern->endIteration);
if (intern->endIteration->common.scope == U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { if (intern->endIteration->common.scope == spl_ce_RecursiveIteratorIterator) {
intern->endIteration = NULL; intern->endIteration = NULL;
} }
zend_hash_find(&intern->ce->function_table, "callhaschildren", sizeof("callHasChildren"), (void **) &intern->callHasChildren); zend_hash_find(&intern->ce->function_table, "callhaschildren", sizeof("callHasChildren"), (void **) &intern->callHasChildren);
if (intern->callHasChildren->common.scope == U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { if (intern->callHasChildren->common.scope == spl_ce_RecursiveIteratorIterator) {
intern->callHasChildren = NULL; intern->callHasChildren = NULL;
} }
zend_hash_find(&intern->ce->function_table, "callgetchildren", sizeof("callGetChildren"), (void **) &intern->callGetChildren); zend_hash_find(&intern->ce->function_table, "callgetchildren", sizeof("callGetChildren"), (void **) &intern->callGetChildren);
if (intern->callGetChildren->common.scope == U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { if (intern->callGetChildren->common.scope == spl_ce_RecursiveIteratorIterator) {
intern->callGetChildren = NULL; intern->callGetChildren = NULL;
} }
zend_hash_find(&intern->ce->function_table, "beginchildren", sizeof("beginchildren"), (void **) &intern->beginChildren); zend_hash_find(&intern->ce->function_table, "beginchildren", sizeof("beginchildren"), (void **) &intern->beginChildren);
if (intern->beginChildren->common.scope == U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { if (intern->beginChildren->common.scope == spl_ce_RecursiveIteratorIterator) {
intern->beginChildren = NULL; intern->beginChildren = NULL;
} }
zend_hash_find(&intern->ce->function_table, "endchildren", sizeof("endchildren"), (void **) &intern->endChildren); zend_hash_find(&intern->ce->function_table, "endchildren", sizeof("endchildren"), (void **) &intern->endChildren);
if (intern->endChildren->common.scope == U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { if (intern->endChildren->common.scope == spl_ce_RecursiveIteratorIterator) {
intern->endChildren = NULL; intern->endChildren = NULL;
} }
zend_hash_find(&intern->ce->function_table, "nextelement", sizeof("nextElement"), (void **) &intern->nextElement); zend_hash_find(&intern->ce->function_table, "nextelement", sizeof("nextElement"), (void **) &intern->nextElement);
if (intern->nextElement->common.scope == U_CLASS_ENTRY(spl_ce_RecursiveIteratorIterator)) { if (intern->nextElement->common.scope == spl_ce_RecursiveIteratorIterator) {
intern->nextElement = NULL; intern->nextElement = NULL;
} }
ce_iterator = Z_OBJCE_P(iterator); /* respect inheritance, don't use spl_ce_RecursiveIterator */ ce_iterator = Z_OBJCE_P(iterator); /* respect inheritance, don't use spl_ce_RecursiveIterator */
@ -633,7 +633,7 @@ SPL_METHOD(RecursiveIteratorIterator, setMaxDepth)
return; return;
} }
if (max_depth < -1) { if (max_depth < -1) {
zend_throw_exception(U_CLASS_ENTRY(spl_ce_OutOfRangeException), "Parameter max_depth must be >= -1", 0 TSRMLS_CC); zend_throw_exception(spl_ce_OutOfRangeException, "Parameter max_depth must be >= -1", 0 TSRMLS_CC);
return; return;
} }
object->max_depth = max_depth; object->max_depth = max_depth;
@ -842,7 +842,7 @@ static inline spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAME
int inc_refcount = 1; int inc_refcount = 1;
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_InvalidArgumentException) TSRMLS_CC); php_set_error_handling(EH_THROW, spl_ce_InvalidArgumentException TSRMLS_CC);
intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
@ -857,12 +857,12 @@ static inline spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAME
} }
if (intern->u.limit.offset < 0) { if (intern->u.limit.offset < 0) {
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
zend_throw_exception(U_CLASS_ENTRY(spl_ce_OutOfRangeException), "Parameter offset must be > 0", 0 TSRMLS_CC); zend_throw_exception(spl_ce_OutOfRangeException, "Parameter offset must be > 0", 0 TSRMLS_CC);
return NULL; return NULL;
} }
if (intern->u.limit.count < 0 && intern->u.limit.count != -1) { if (intern->u.limit.count < 0 && intern->u.limit.count != -1) {
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
zend_throw_exception(U_CLASS_ENTRY(spl_ce_OutOfRangeException), "Parameter count must either be -1 or a value greater than or equal 0", 0 TSRMLS_CC); zend_throw_exception(spl_ce_OutOfRangeException, "Parameter count must either be -1 or a value greater than or equal 0", 0 TSRMLS_CC);
return NULL; return NULL;
} }
break; break;
@ -877,7 +877,7 @@ static inline spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAME
if (((flags & CIT_CALL_TOSTRING) && (flags & (CIT_TOSTRING_USE_KEY|CIT_TOSTRING_USE_CURRENT))) if (((flags & CIT_CALL_TOSTRING) && (flags & (CIT_TOSTRING_USE_KEY|CIT_TOSTRING_USE_CURRENT)))
|| ((flags & (CIT_TOSTRING_USE_KEY|CIT_TOSTRING_USE_CURRENT)) == (CIT_TOSTRING_USE_KEY|CIT_TOSTRING_USE_CURRENT))) { || ((flags & (CIT_TOSTRING_USE_KEY|CIT_TOSTRING_USE_CURRENT)) == (CIT_TOSTRING_USE_KEY|CIT_TOSTRING_USE_CURRENT))) {
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
zend_throw_exception(U_CLASS_ENTRY(spl_ce_InvalidArgumentException), "Flags must contain only one of CATCH_GET_CHILD, CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT", 0 TSRMLS_CC); zend_throw_exception(spl_ce_InvalidArgumentException, "Flags must contain only one of CATCH_GET_CHILD, CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT", 0 TSRMLS_CC);
return NULL; return NULL;
} }
intern->u.caching.flags |= flags & CIT_PUBLIC; intern->u.caching.flags |= flags & CIT_PUBLIC;
@ -895,22 +895,22 @@ static inline spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAME
return NULL; return NULL;
} }
ce = Z_OBJCE_P(zobject); ce = Z_OBJCE_P(zobject);
if (!instanceof_function(ce, U_CLASS_ENTRY(zend_ce_iterator) TSRMLS_CC)) { if (!instanceof_function(ce, zend_ce_iterator TSRMLS_CC)) {
if (ZEND_NUM_ARGS() > 1) { if (ZEND_NUM_ARGS() > 1) {
if (zend_lookup_class(class_name, class_name_len, &pce_cast TSRMLS_CC) == FAILURE if (zend_lookup_class(class_name, class_name_len, &pce_cast TSRMLS_CC) == FAILURE
|| !instanceof_function(ce, *pce_cast TSRMLS_CC) || !instanceof_function(ce, *pce_cast TSRMLS_CC)
|| !(*pce_cast)->get_iterator || !(*pce_cast)->get_iterator
) { ) {
zend_throw_exception(U_CLASS_ENTRY(spl_ce_LogicException), "Class to downcast to not found or not base class or does not implement Traversable", 0 TSRMLS_CC); zend_throw_exception(spl_ce_LogicException, "Class to downcast to not found or not base class or does not implement Traversable", 0 TSRMLS_CC);
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
return NULL; return NULL;
} }
ce = *pce_cast; ce = *pce_cast;
} }
if (instanceof_function(ce, U_CLASS_ENTRY(zend_ce_aggregate) TSRMLS_CC)) { if (instanceof_function(ce, zend_ce_aggregate TSRMLS_CC)) {
zend_call_method_with_0_params(&zobject, ce, &ce->iterator_funcs.zf_new_iterator, "getiterator", &retval); zend_call_method_with_0_params(&zobject, ce, &ce->iterator_funcs.zf_new_iterator, "getiterator", &retval);
if (!retval || Z_TYPE_P(retval) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(retval), U_CLASS_ENTRY(zend_ce_traversable) TSRMLS_CC)) { if (!retval || Z_TYPE_P(retval) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(retval), zend_ce_traversable TSRMLS_CC)) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_LogicException), 0 TSRMLS_CC, "%s::getIterator() must return an object that implememnts Traversable", ce->name); zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "%s::getIterator() must return an object that implememnts Traversable", ce->name);
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
return NULL; return NULL;
} }
@ -922,9 +922,9 @@ static inline spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAME
break; break;
} }
case DIT_AppendIterator: case DIT_AppendIterator:
spl_instantiate(U_CLASS_ENTRY(spl_ce_ArrayIterator), &intern->u.append.zarrayit, 1 TSRMLS_CC); spl_instantiate(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); zend_call_method_with_0_params(&intern->u.append.zarrayit, spl_ce_ArrayIterator, &spl_ce_ArrayIterator->constructor, "__construct", NULL);
intern->u.append.iterator = U_CLASS_ENTRY(spl_ce_ArrayIterator)->get_iterator(U_CLASS_ENTRY(spl_ce_ArrayIterator), intern->u.append.zarrayit, 0 TSRMLS_CC); intern->u.append.iterator = spl_ce_ArrayIterator->get_iterator(spl_ce_ArrayIterator, intern->u.append.zarrayit, 0 TSRMLS_CC);
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
return intern; return intern;
#if HAVE_PCRE || HAVE_BUNDLED_PCRE #if HAVE_PCRE || HAVE_BUNDLED_PCRE
@ -970,7 +970,7 @@ static inline spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAME
Create an Iterator from another iterator */ Create an Iterator from another iterator */
SPL_METHOD(dual_it, __construct) SPL_METHOD(dual_it, __construct)
{ {
spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_iterator), DIT_Default); spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_iterator, DIT_Default);
} /* }}} */ } /* }}} */
/* {{{ proto Iterator FilterIterator::getInnerIterator() /* {{{ proto Iterator FilterIterator::getInnerIterator()
@ -1212,7 +1212,7 @@ SPL_METHOD(FilterIterator, next)
Create a RecursiveFilterIterator from a RecursiveIterator */ Create a RecursiveFilterIterator from a RecursiveIterator */
SPL_METHOD(RecursiveFilterIterator, __construct) SPL_METHOD(RecursiveFilterIterator, __construct)
{ {
spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(spl_ce_RecursiveIterator), DIT_Default); spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_RecursiveIterator, DIT_Default);
} /* }}} */ } /* }}} */
/* {{{ proto boolean RecursiveFilterIterator::hasChildren() /* {{{ proto boolean RecursiveFilterIterator::hasChildren()
@ -1246,7 +1246,7 @@ SPL_METHOD(RecursiveFilterIterator, getChildren)
Create a ParentIterator from a RecursiveIterator */ Create a ParentIterator from a RecursiveIterator */
SPL_METHOD(ParentIterator, __construct) SPL_METHOD(ParentIterator, __construct)
{ {
spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(spl_ce_RecursiveIterator), DIT_Default); spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_RecursiveIterator, DIT_Default);
} /* }}} */ } /* }}} */
/* {{{ proto boolean ParentIterator::hasChildren() /* {{{ proto boolean ParentIterator::hasChildren()
@ -1281,7 +1281,7 @@ SPL_METHOD(ParentIterator, getChildren)
Create an RegExIterator from another iterator and a regular expression */ Create an RegExIterator from another iterator and a regular expression */
SPL_METHOD(RegExIterator, __construct) SPL_METHOD(RegExIterator, __construct)
{ {
spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_iterator), DIT_RegExIterator); spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_iterator, DIT_RegExIterator);
} /* }}} */ } /* }}} */
/* {{{ proto bool RegExIterator::accept() /* {{{ proto bool RegExIterator::accept()
@ -1330,7 +1330,7 @@ SPL_METHOD(RegExIterator, accept)
Create an RecursiveRegExIterator from another recursive iterator and a regular expression */ Create an RecursiveRegExIterator from another recursive iterator and a regular expression */
SPL_METHOD(RecursiveRegExIterator, __construct) SPL_METHOD(RecursiveRegExIterator, __construct)
{ {
spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(spl_ce_RecursiveIterator), DIT_RecursiveRegExIterator); spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_RecursiveIterator, DIT_RecursiveRegExIterator);
} /* }}} */ } /* }}} */
#endif #endif
@ -1473,14 +1473,14 @@ static inline void spl_limit_it_seek(spl_dual_it_object *intern, long pos TSRMLS
spl_dual_it_free(intern TSRMLS_CC); spl_dual_it_free(intern TSRMLS_CC);
if (pos < intern->u.limit.offset) { if (pos < intern->u.limit.offset) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_OutOfBoundsException), 0 TSRMLS_CC, "Cannot seek to %ld which is below the offset %ld", pos, intern->u.limit.offset); zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %ld which is below the offset %ld", pos, intern->u.limit.offset);
return; return;
} }
if (pos > intern->u.limit.offset + intern->u.limit.count && intern->u.limit.count != -1) { if (pos > intern->u.limit.offset + intern->u.limit.count && intern->u.limit.count != -1) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_OutOfBoundsException), 0 TSRMLS_CC, "Cannot seek to %ld which is behind offest %ld plus count %ld", pos, intern->u.limit.offset, intern->u.limit.count); zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %ld which is behind offest %ld plus count %ld", pos, intern->u.limit.offset, intern->u.limit.count);
return; return;
} }
if (instanceof_function(intern->inner.ce, U_CLASS_ENTRY(spl_ce_SeekableIterator) TSRMLS_CC)) { if (instanceof_function(intern->inner.ce, spl_ce_SeekableIterator TSRMLS_CC)) {
MAKE_STD_ZVAL(zpos); MAKE_STD_ZVAL(zpos);
ZVAL_LONG(zpos, pos); ZVAL_LONG(zpos, pos);
spl_dual_it_free(intern TSRMLS_CC); spl_dual_it_free(intern TSRMLS_CC);
@ -1509,7 +1509,7 @@ static inline void spl_limit_it_seek(spl_dual_it_object *intern, long pos TSRMLS
Construct a LimitIterator from an Iterator with a given starting offset and optionally a maximum count */ Construct a LimitIterator from an Iterator with a given starting offset and optionally a maximum count */
SPL_METHOD(LimitIterator, __construct) SPL_METHOD(LimitIterator, __construct)
{ {
spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_iterator), DIT_LimitIterator); spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_iterator, DIT_LimitIterator);
} /* }}} */ } /* }}} */
/* {{{ proto void LimitIterator::rewind() /* {{{ proto void LimitIterator::rewind()
@ -1649,7 +1649,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern TSRMLS_DC)
} else { } else {
INIT_PZVAL(&zflags); INIT_PZVAL(&zflags);
ZVAL_LONG(&zflags, intern->u.caching.flags & CIT_PUBLIC); ZVAL_LONG(&zflags, intern->u.caching.flags & CIT_PUBLIC);
spl_instantiate_arg_ex2(U_CLASS_ENTRY(spl_ce_RecursiveCachingIterator), &intern->u.caching.zchildren, 1, zchildren, &zflags TSRMLS_CC); spl_instantiate_arg_ex2(spl_ce_RecursiveCachingIterator, &intern->u.caching.zchildren, 1, zchildren, &zflags TSRMLS_CC);
zval_ptr_dtor(&zchildren); zval_ptr_dtor(&zchildren);
} }
} }
@ -1692,7 +1692,7 @@ static inline void spl_caching_it_rewind(spl_dual_it_object *intern TSRMLS_DC)
Construct a CachingIterator from an Iterator */ Construct a CachingIterator from an Iterator */
SPL_METHOD(CachingIterator, __construct) SPL_METHOD(CachingIterator, __construct)
{ {
spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_iterator), DIT_CachingIterator); spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_iterator, DIT_CachingIterator);
} /* }}} */ } /* }}} */
/* {{{ proto void CachingIterator::rewind() /* {{{ proto void CachingIterator::rewind()
@ -1748,7 +1748,7 @@ SPL_METHOD(CachingIterator, __toString)
intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
if (!(intern->u.caching.flags & (CIT_CALL_TOSTRING|CIT_TOSTRING_USE_KEY|CIT_TOSTRING_USE_CURRENT))) { if (!(intern->u.caching.flags & (CIT_CALL_TOSTRING|CIT_TOSTRING_USE_KEY|CIT_TOSTRING_USE_CURRENT))) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_BadMethodCallException), 0 TSRMLS_CC, "%v does not fetch string value (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%v does not fetch string value (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name);
} }
if (intern->u.caching.flags & CIT_TOSTRING_USE_KEY) { if (intern->u.caching.flags & CIT_TOSTRING_USE_KEY) {
if (intern->current.key_type == HASH_KEY_IS_STRING) { if (intern->current.key_type == HASH_KEY_IS_STRING) {
@ -1788,7 +1788,7 @@ SPL_METHOD(CachingIterator, offsetSet)
intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) { if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_BadMethodCallException), 0 TSRMLS_CC, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name);
} }
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Tz", &arKey, &nKeyLength, &type, &value) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Tz", &arKey, &nKeyLength, &type, &value) == FAILURE) {
@ -1813,7 +1813,7 @@ SPL_METHOD(CachingIterator, offsetGet)
intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) { if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_BadMethodCallException), 0 TSRMLS_CC, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name);
} }
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "T", &arKey, &nKeyLength, &type) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "T", &arKey, &nKeyLength, &type) == FAILURE) {
@ -1841,7 +1841,7 @@ SPL_METHOD(CachingIterator, offsetUnset)
intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) { if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_BadMethodCallException), 0 TSRMLS_CC, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name);
} }
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "T", &arKey, &nKeyLength, &type) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "T", &arKey, &nKeyLength, &type) == FAILURE) {
@ -1864,7 +1864,7 @@ SPL_METHOD(CachingIterator, offsetExists)
intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) { if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_BadMethodCallException), 0 TSRMLS_CC, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%v does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name);
} }
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "T", &arKey, &nKeyLength, &type) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "T", &arKey, &nKeyLength, &type) == FAILURE) {
@ -1906,7 +1906,7 @@ SPL_METHOD(CachingIterator, setFlags)
return; return;
} }
if ((intern->u.caching.flags & CIT_CALL_TOSTRING) != 0 && (flags & ~CIT_CALL_TOSTRING) == 0) { if ((intern->u.caching.flags & CIT_CALL_TOSTRING) != 0 && (flags & ~CIT_CALL_TOSTRING) == 0) {
zend_throw_exception(U_CLASS_ENTRY(spl_ce_InvalidArgumentException), "Unsetting flag CALL_TO_STRING is not possible", 0 TSRMLS_CC); zend_throw_exception(spl_ce_InvalidArgumentException, "Unsetting flag CALL_TO_STRING is not possible", 0 TSRMLS_CC);
return; return;
} }
if ((flags && CIT_FULL_CACHE) != 0 && (intern->u.caching.flags & CIT_FULL_CACHE) == 0) { if ((flags && CIT_FULL_CACHE) != 0 && (intern->u.caching.flags & CIT_FULL_CACHE) == 0) {
@ -1962,7 +1962,7 @@ static zend_function_entry spl_funcs_CachingIterator[] = {
Create an iterator from a RecursiveIterator */ Create an iterator from a RecursiveIterator */
SPL_METHOD(RecursiveCachingIterator, __construct) SPL_METHOD(RecursiveCachingIterator, __construct)
{ {
spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(spl_ce_RecursiveIterator), DIT_RecursiveCachingIterator); spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_RecursiveIterator, DIT_RecursiveCachingIterator);
} /* }}} */ } /* }}} */
/* {{{ proto bolean RecursiveCachingIterator::hasChildren() /* {{{ proto bolean RecursiveCachingIterator::hasChildren()
@ -2008,7 +2008,7 @@ static zend_function_entry spl_funcs_RecursiveCachingIterator[] = {
Create an iterator from anything that is traversable */ Create an iterator from anything that is traversable */
SPL_METHOD(IteratorIterator, __construct) SPL_METHOD(IteratorIterator, __construct)
{ {
spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_traversable), DIT_IteratorIterator); spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_traversable, DIT_IteratorIterator);
} /* }}} */ } /* }}} */
static static
@ -2031,7 +2031,7 @@ static zend_function_entry spl_funcs_IteratorIterator[] = {
Create an iterator from another iterator */ Create an iterator from another iterator */
SPL_METHOD(NoRewindIterator, __construct) SPL_METHOD(NoRewindIterator, __construct)
{ {
spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_iterator), DIT_NoRewindIterator); spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_iterator, DIT_NoRewindIterator);
} /* }}} */ } /* }}} */
/* {{{ proto void NoRewindIterator::rewind() /* {{{ proto void NoRewindIterator::rewind()
@ -2123,7 +2123,7 @@ static zend_function_entry spl_funcs_NoRewindIterator[] = {
Create an iterator from another iterator */ Create an iterator from another iterator */
SPL_METHOD(InfiniteIterator, __construct) SPL_METHOD(InfiniteIterator, __construct)
{ {
spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_iterator), DIT_InfiniteIterator); spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_iterator, DIT_InfiniteIterator);
} /* }}} */ } /* }}} */
/* {{{ proto InfiniteIterator::next() /* {{{ proto InfiniteIterator::next()
@ -2168,14 +2168,14 @@ SPL_METHOD(EmptyIterator, valid)
Throws exception */ Throws exception */
SPL_METHOD(EmptyIterator, key) SPL_METHOD(EmptyIterator, key)
{ {
zend_throw_exception(U_CLASS_ENTRY(spl_ce_BadMethodCallException), "Accessing the key of an EmptyIterator", 0 TSRMLS_CC); zend_throw_exception(spl_ce_BadMethodCallException, "Accessing the key of an EmptyIterator", 0 TSRMLS_CC);
} /* }}} */ } /* }}} */
/* {{{ proto EmptyIterator::current() /* {{{ proto EmptyIterator::current()
Throws exception */ Throws exception */
SPL_METHOD(EmptyIterator, current) SPL_METHOD(EmptyIterator, current)
{ {
zend_throw_exception(U_CLASS_ENTRY(spl_ce_BadMethodCallException), "Accessing the value of an EmptyIterator", 0 TSRMLS_CC); zend_throw_exception(spl_ce_BadMethodCallException, "Accessing the value of an EmptyIterator", 0 TSRMLS_CC);
} /* }}} */ } /* }}} */
/* {{{ proto EmptyIterator::next() /* {{{ proto EmptyIterator::next()
@ -2246,7 +2246,7 @@ void spl_append_it_next(spl_dual_it_object *intern TSRMLS_DC) /* {{{ */
Create an AppendIterator */ Create an AppendIterator */
SPL_METHOD(AppendIterator, __construct) SPL_METHOD(AppendIterator, __construct)
{ {
spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(zend_ce_iterator), DIT_AppendIterator); spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_ce_iterator, DIT_AppendIterator);
} /* }}} */ } /* }}} */
/* {{{ proto void AppendIterator::append(Iterator it) /* {{{ proto void AppendIterator::append(Iterator it)
@ -2258,7 +2258,7 @@ SPL_METHOD(AppendIterator, append)
intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &it, U_CLASS_ENTRY(zend_ce_iterator)) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &it, zend_ce_iterator) == FAILURE) {
return; return;
} }
spl_array_iterator_append(intern->u.append.zarrayit, it TSRMLS_CC); spl_array_iterator_append(intern->u.append.zarrayit, it TSRMLS_CC);
@ -2362,7 +2362,7 @@ PHP_FUNCTION(iterator_to_array)
ulong int_key; ulong int_key;
int key_type; int key_type;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &obj, U_CLASS_ENTRY(zend_ce_traversable)) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &obj, zend_ce_traversable) == FAILURE) {
RETURN_FALSE; RETURN_FALSE;
} }
@ -2408,7 +2408,7 @@ PHP_FUNCTION(iterator_count)
zend_object_iterator *iter; zend_object_iterator *iter;
long count = 0; long count = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &obj, U_CLASS_ENTRY(zend_ce_traversable)) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &obj, zend_ce_traversable) == FAILURE) {
RETURN_FALSE; RETURN_FALSE;
} }

View file

@ -879,12 +879,12 @@ static zend_object_value sqlite_object_new_exception(zend_class_entry *class_typ
static zend_class_entry *sqlite_get_ce_query(zval *object TSRMLS_DC) static zend_class_entry *sqlite_get_ce_query(zval *object TSRMLS_DC)
{ {
return U_CLASS_ENTRY(sqlite_ce_query); return sqlite_ce_query;
} }
static zend_class_entry *sqlite_get_ce_ub_query(zval *object TSRMLS_DC) static zend_class_entry *sqlite_get_ce_ub_query(zval *object TSRMLS_DC)
{ {
return U_CLASS_ENTRY(sqlite_ce_ub_query); return sqlite_ce_ub_query;
} }
static zval * sqlite_instanciate(zend_class_entry *pce, zval *object TSRMLS_DC) static zval * sqlite_instanciate(zend_class_entry *pce, zval *object TSRMLS_DC)
@ -1188,7 +1188,7 @@ static struct php_sqlite_db *php_sqlite_open(char *filename, int mode, char *per
if (object) { if (object) {
/* if object is not an object then we're called from the factory() function */ /* if object is not an object then we're called from the factory() function */
if (Z_TYPE_P(object) != IS_OBJECT) { if (Z_TYPE_P(object) != IS_OBJECT) {
sqlite_instanciate(U_CLASS_ENTRY(sqlite_ce_db), object TSRMLS_CC); sqlite_instanciate(sqlite_ce_db, object TSRMLS_CC);
} }
/* and now register the object */ /* and now register the object */
SQLITE_REGISTER_OBJECT(db, object, db) SQLITE_REGISTER_OBJECT(db, object, db)
@ -1295,7 +1295,7 @@ PHP_FUNCTION(sqlite_open)
zval *errmsg = NULL; zval *errmsg = NULL;
zval *object = getThis(); zval *object = getThis();
php_set_error_handling(object ? EH_THROW : EH_NORMAL, U_CLASS_ENTRY(sqlite_ce_exception) TSRMLS_CC); php_set_error_handling(object ? EH_THROW : EH_NORMAL, sqlite_ce_exception TSRMLS_CC);
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz/", if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz/",
&filename, &filename_len, &mode, &errmsg)) { &filename, &filename_len, &mode, &errmsg)) {
php_std_error_handling(); php_std_error_handling();
@ -1350,7 +1350,7 @@ PHP_FUNCTION(sqlite_factory)
int filename_len; int filename_len;
zval *errmsg = NULL; zval *errmsg = NULL;
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(sqlite_ce_exception) TSRMLS_CC); php_set_error_handling(EH_THROW, sqlite_ce_exception TSRMLS_CC);
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz/", if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz/",
&filename, &filename_len, &mode, &errmsg)) { &filename, &filename_len, &mode, &errmsg)) {
php_std_error_handling(); php_std_error_handling();
@ -1577,9 +1577,9 @@ terminate:
if (object) { if (object) {
sqlite_object *obj; sqlite_object *obj;
if (buffered) { if (buffered) {
sqlite_instanciate(U_CLASS_ENTRY(sqlite_ce_query), return_value TSRMLS_CC); sqlite_instanciate(sqlite_ce_query, return_value TSRMLS_CC);
} else { } else {
sqlite_instanciate(U_CLASS_ENTRY(sqlite_ce_ub_query), return_value TSRMLS_CC); sqlite_instanciate(sqlite_ce_ub_query, return_value TSRMLS_CC);
} }
obj = (sqlite_object *) zend_object_store_get_object(return_value TSRMLS_CC); obj = (sqlite_object *) zend_object_store_get_object(return_value TSRMLS_CC);
obj->type = is_result; obj->type = is_result;
@ -2073,7 +2073,7 @@ PHP_FUNCTION(sqlite_fetch_object)
zval *ctor_params = NULL; zval *ctor_params = NULL;
zend_uchar class_name_type; zend_uchar class_name_type;
php_set_error_handling(object ? EH_THROW : EH_NORMAL, U_CLASS_ENTRY(sqlite_ce_exception) TSRMLS_CC); php_set_error_handling(object ? EH_THROW : EH_NORMAL, sqlite_ce_exception TSRMLS_CC);
if (object) { if (object) {
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|tzb", &class_name, &class_name_len, &class_name_type, &ctor_params, &decode_binary)) { if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|tzb", &class_name, &class_name_len, &class_name_type, &ctor_params, &decode_binary)) {
php_std_error_handling(); php_std_error_handling();
@ -2081,7 +2081,7 @@ PHP_FUNCTION(sqlite_fetch_object)
} }
RES_FROM_OBJECT(res, object); RES_FROM_OBJECT(res, object);
if (!ZEND_NUM_ARGS()) { if (!ZEND_NUM_ARGS()) {
ce = U_CLASS_ENTRY(zend_standard_class_def); ce = zend_standard_class_def;
} else { } else {
ce = zend_u_fetch_class(class_name_type, class_name, class_name_len, ZEND_FETCH_CLASS_AUTO TSRMLS_CC); ce = zend_u_fetch_class(class_name_type, class_name, class_name_len, ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
} }
@ -2092,14 +2092,14 @@ PHP_FUNCTION(sqlite_fetch_object)
} }
ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result); ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result);
if (ZEND_NUM_ARGS() < 2) { if (ZEND_NUM_ARGS() < 2) {
ce = U_CLASS_ENTRY(zend_standard_class_def); ce = zend_standard_class_def;
} else { } else {
ce = zend_u_fetch_class(class_name_type, class_name, class_name_len, ZEND_FETCH_CLASS_AUTO TSRMLS_CC); ce = zend_u_fetch_class(class_name_type, class_name, class_name_len, ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
} }
} }
if (!ce) { if (!ce) {
zend_throw_exception_ex(U_CLASS_ENTRY(sqlite_ce_exception), 0 TSRMLS_CC, "Could not find class '%s'", class_name); zend_throw_exception_ex(sqlite_ce_exception, 0 TSRMLS_CC, "Could not find class '%s'", class_name);
php_std_error_handling(); php_std_error_handling();
return; return;
} }
@ -2142,7 +2142,7 @@ PHP_FUNCTION(sqlite_fetch_object)
* single value is an array. Also we'd have to make that one * single value is an array. Also we'd have to make that one
* argument passed by reference. * argument passed by reference.
*/ */
zend_throw_exception(U_CLASS_ENTRY(sqlite_ce_exception), "Parameter ctor_params must be an array", 0 TSRMLS_CC); zend_throw_exception(sqlite_ce_exception, "Parameter ctor_params must be an array", 0 TSRMLS_CC);
return; return;
} }
} else { } else {
@ -2157,7 +2157,7 @@ PHP_FUNCTION(sqlite_fetch_object)
fcc.object_pp = &return_value; fcc.object_pp = &return_value;
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) { if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
zend_throw_exception_ex(U_CLASS_ENTRY(sqlite_ce_exception), 0 TSRMLS_CC, "Could not execute %s::%v()", class_name, ce->constructor->common.function_name); zend_throw_exception_ex(sqlite_ce_exception, 0 TSRMLS_CC, "Could not execute %s::%v()", class_name, ce->constructor->common.function_name);
} else { } else {
if (retval_ptr) { if (retval_ptr) {
zval_ptr_dtor(&retval_ptr); zval_ptr_dtor(&retval_ptr);
@ -2167,7 +2167,7 @@ PHP_FUNCTION(sqlite_fetch_object)
efree(fci.params); efree(fci.params);
} }
} else if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) { } else if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) {
zend_throw_exception_ex(U_CLASS_ENTRY(sqlite_ce_exception), 0 TSRMLS_CC, "Class %s does not have a constructor, use NULL for parameter ctor_params or omit it", class_name); zend_throw_exception_ex(sqlite_ce_exception, 0 TSRMLS_CC, "Class %s does not have a constructor, use NULL for parameter ctor_params or omit it", class_name);
} }
} }
/* }}} */ /* }}} */
@ -2545,7 +2545,7 @@ static int sqlite_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */
* count = obj->u.res->nrows; * count = obj->u.res->nrows;
return SUCCESS; return SUCCESS;
} else { } else {
zend_throw_exception(U_CLASS_ENTRY(sqlite_ce_exception), "Row count is not available for unbuffered queries", 0 TSRMLS_CC); zend_throw_exception(sqlite_ce_exception, "Row count is not available for unbuffered queries", 0 TSRMLS_CC);
return FAILURE; return FAILURE;
} }
} /* }}} */ } /* }}} */

View file

@ -316,7 +316,7 @@ PHP_FUNCTION(count)
/* it the object implements Countable we call its count() method */ /* it the object implements Countable we call its count() method */
zval *retval; zval *retval;
if (Z_OBJ_HT_P(array)->get_class_entry && instanceof_function(Z_OBJCE_P(array), U_CLASS_ENTRY(spl_ce_Countable) TSRMLS_CC)) { if (Z_OBJ_HT_P(array)->get_class_entry && instanceof_function(Z_OBJCE_P(array), spl_ce_Countable TSRMLS_CC)) {
zend_call_method_with_0_params(&array, NULL, NULL, "count", &retval); zend_call_method_with_0_params(&array, NULL, NULL, "count", &retval);
RETVAL_LONG(Z_LVAL_P(retval)); RETVAL_LONG(Z_LVAL_P(retval));
zval_ptr_dtor(&retval); zval_ptr_dtor(&retval);

View file

@ -201,7 +201,7 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject)
php_set_default_dir(dirp->rsrc_id TSRMLS_CC); php_set_default_dir(dirp->rsrc_id TSRMLS_CC);
if (createobject) { if (createobject) {
object_init_ex(return_value, U_CLASS_ENTRY(dir_class_entry_ptr)); object_init_ex(return_value, dir_class_entry_ptr);
add_property_rt_stringl(return_value, "path", dirname, dir_len, 1); add_property_rt_stringl(return_value, "path", dirname, dir_len, 1);
add_property_resource(return_value, "handle", dirp->rsrc_id); add_property_resource(return_value, "handle", dirp->rsrc_id);
php_stream_auto_cleanup(dirp); /* so we don't get warnings under debug */ php_stream_auto_cleanup(dirp); /* so we don't get warnings under debug */

View file

@ -539,7 +539,7 @@ PHP_METHOD(TextIterator, __construct)
intern->flags = flags; intern->flags = flags;
} }
if (Z_OBJCE_P(this_ptr) == U_CLASS_ENTRY(rev_text_iterator_ce)) { if (Z_OBJCE_P(this_ptr) == rev_text_iterator_ce) {
intern->flags |= ITER_REVERSE; intern->flags |= ITER_REVERSE;
} }

View file

@ -75,6 +75,7 @@ SAPI_API sapi_module_struct sapi_module;
SAPI_API void sapi_startup(sapi_module_struct *sf) SAPI_API void sapi_startup(sapi_module_struct *sf)
{ {
sf->ini_entries = NULL;
sapi_module = *sf; sapi_module = *sf;
#ifdef ZTS #ifdef ZTS

View file

@ -258,6 +258,8 @@ struct _sapi_module_struct {
void (*ini_defaults)(HashTable *configuration_hash); void (*ini_defaults)(HashTable *configuration_hash);
int phpinfo_as_text; int phpinfo_as_text;
char *ini_entries;
}; };

View file

@ -524,6 +524,11 @@ int php_init_config(TSRMLS_D)
zend_llist_destroy(&scanned_ini_list); zend_llist_destroy(&scanned_ini_list);
} }
} }
if (sapi_module.ini_entries) {
zend_parse_ini_string(sapi_module.ini_entries, 1, php_config_ini_parser_cb, &extension_lists);
}
return SUCCESS; return SUCCESS;
} }
/* }}} */ /* }}} */

View file

@ -581,6 +581,7 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
php_register_variable_safe(var, val, new_val_len, array_ptr TSRMLS_CC); php_register_variable_safe(var, val, new_val_len, array_ptr TSRMLS_CC);
} }
*/ */
efree(u_var);
efree(u_val); efree(u_val);
} }
} else { } else {
@ -696,16 +697,12 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
} }
/* auto-type */ /* auto-type */
ALLOC_ZVAL(tmp); ALLOC_ZVAL(tmp);
Z_TYPE_P(tmp) = IS_STRING; ZVAL_RT_STRING(tmp, ss, 1);
Z_STRLEN_P(tmp) = strlen(ss);
Z_STRVAL_P(tmp) = estrndup(ss, Z_STRLEN_P(tmp));
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
count++; count++;
if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(zval *), NULL) == FAILURE) { if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(zval *), NULL) == FAILURE) {
if (Z_TYPE_P(tmp) == IS_STRING) {
efree(Z_STRVAL_P(tmp)); efree(Z_STRVAL_P(tmp));
} }
}
if (space) { if (space) {
*space = '+'; *space = '+';
ss = space + 1; ss = space + 1;

View file

@ -846,22 +846,6 @@ static void init_request_info(TSRMLS_D)
} }
/* }}} */ /* }}} */
static void define_command_line_ini_entry(char *arg)
{
char *name, *value;
name = arg;
value = strchr(arg, '=');
if (value) {
*value = 0;
value++;
} else {
value = "1";
}
zend_alter_ini_entry(name, strlen(name) + 1, value, strlen(value), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
}
static void php_register_command_line_global_vars(char **arg TSRMLS_DC) static void php_register_command_line_global_vars(char **arg TSRMLS_DC)
{ {
char *var, *val; char *var, *val;
@ -913,6 +897,7 @@ int main(int argc, char *argv[])
char *orig_optarg = php_optarg; char *orig_optarg = php_optarg;
char *script_file = NULL; char *script_file = NULL;
zend_llist global_vars; zend_llist global_vars;
int ini_entries_len = 0;
/* end of temporary locals */ /* end of temporary locals */
#ifdef ZTS #ifdef ZTS
@ -995,6 +980,23 @@ int main(int argc, char *argv[])
/* if we're started on command line, check to see if /* if we're started on command line, check to see if
we are being started as an 'external' fastcgi we are being started as an 'external' fastcgi
server by accepting a bindpath parameter. */ server by accepting a bindpath parameter. */
case 'd': {
/* define ini entries on command line */
int len = strlen(php_optarg);
if (strchr(php_optarg, '=')) {
cgi_sapi_module.ini_entries = realloc(cgi_sapi_module.ini_entries, ini_entries_len + len + sizeof("\n\0"));
memcpy(cgi_sapi_module.ini_entries + ini_entries_len, php_optarg, len);
memcpy(cgi_sapi_module.ini_entries + ini_entries_len + len, "\n\0", sizeof("\n\0"));
ini_entries_len += len + sizeof("\n\0") - 2;
} else {
cgi_sapi_module.ini_entries = realloc(cgi_sapi_module.ini_entries, ini_entries_len + len + sizeof("=1\n\0"));
memcpy(cgi_sapi_module.ini_entries + ini_entries_len, php_optarg, len);
memcpy(cgi_sapi_module.ini_entries + ini_entries_len + len, "=1\n\0", sizeof("=1\n\0"));
ini_entries_len += len + sizeof("=1\n\0") - 2;
}
break;
}
case 'b': case 'b':
if (!fastcgi) { if (!fastcgi) {
bindpath = strdup(php_optarg); bindpath = strdup(php_optarg);
@ -1270,9 +1272,6 @@ consult the installation file that came with this distribution, or visit \n\
case 'C': /* don't chdir to the script directory */ case 'C': /* don't chdir to the script directory */
SG(options) |= SAPI_OPTION_NO_CHDIR; SG(options) |= SAPI_OPTION_NO_CHDIR;
break; break;
case 'd': /* define ini entries on command line */
define_command_line_ini_entry(php_optarg);
break;
case 'e': /* enable extended info output */ case 'e': /* enable extended info output */
CG(extended_info) = 1; CG(extended_info) = 1;
@ -1586,6 +1585,9 @@ fastcgi_request_done:
if (cgi_sapi_module.php_ini_path_override) { if (cgi_sapi_module.php_ini_path_override) {
free(cgi_sapi_module.php_ini_path_override); free(cgi_sapi_module.php_ini_path_override);
} }
if (cgi_sapi_module.ini_entries) {
free(cgi_sapi_module.ini_entries);
}
} zend_catch { } zend_catch {
exit_status = 255; exit_status = 255;
} zend_end_try(); } zend_end_try();
@ -1595,7 +1597,7 @@ fastcgi_request_done:
sapi_shutdown(); sapi_shutdown();
#ifdef ZTS #ifdef ZTS
/*tsrm_shutdown();*/ tsrm_shutdown();
#endif #endif
#if defined(PHP_WIN32) && ZEND_DEBUG && 0 #if defined(PHP_WIN32) && ZEND_DEBUG && 0

View file

@ -106,6 +106,14 @@
#define PHP_MODE_REFLECTION_CLASS 9 #define PHP_MODE_REFLECTION_CLASS 9
#define PHP_MODE_REFLECTION_EXTENSION 10 #define PHP_MODE_REFLECTION_EXTENSION 10
#define HARDCODED_INI \
"html_errors=0\n" \
"register_argc_argv=1\n" \
"implicit_flush=1\n" \
"output_buffering=0\n" \
"max_execution_time=0\n"
static char *php_optarg = NULL; static char *php_optarg = NULL;
static int php_optind = 1; static int php_optind = 1;
#if (HAVE_LIBREADLINE || HAVE_LIBEDIT) && !defined(COMPILE_DL_READLINE) #if (HAVE_LIBREADLINE || HAVE_LIBEDIT) && !defined(COMPILE_DL_READLINE)
@ -335,10 +343,6 @@ static int php_cli_startup(sapi_module_struct *sapi_module)
zend_hash_update(configuration_hash, name, sizeof(name), tmp, sizeof(zval), (void**)&entry);\ zend_hash_update(configuration_hash, name, sizeof(name), tmp, sizeof(zval), (void**)&entry);\
Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry)) Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry))
/* hard coded ini settings must be set in main() */
#define INI_HARDCODED(name,value)\
zend_alter_ini_entry(name, sizeof(name), value, strlen(value), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
static void sapi_cli_ini_defaults(HashTable *configuration_hash) static void sapi_cli_ini_defaults(HashTable *configuration_hash)
{ {
zval *tmp, *entry; zval *tmp, *entry;
@ -442,29 +446,6 @@ static void php_cli_usage(char *argv0)
} }
/* }}} */ /* }}} */
static void define_command_line_ini_entry(char *arg TSRMLS_DC)
{
char *name, *value;
name = arg;
value = strchr(arg, '=');
if (value) {
*value = 0;
value++;
} else {
value = "1";
}
if (!strcasecmp(name, "extension")) { /* load function module */
zval extension, zval;
ZVAL_STRING(&extension, value, 0);
php_dl(&extension, MODULE_PERSISTENT, &zval, 1 TSRMLS_CC);
} else {
zend_alter_ini_entry(name, strlen(name)+1, value, strlen(value), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
}
}
static void php_register_command_line_global_vars(char **arg TSRMLS_DC) static void php_register_command_line_global_vars(char **arg TSRMLS_DC)
{ {
char *var, *val; char *var, *val;
@ -608,6 +589,7 @@ int main(int argc, char *argv[])
int argc = __argc; int argc = __argc;
char **argv = __argv; char **argv = __argv;
#endif #endif
int ini_entries_len = 0;
#if defined(PHP_WIN32) && defined(_DEBUG) && defined(PHP_WIN32_DEBUG_HEAP) #if defined(PHP_WIN32) && defined(_DEBUG) && defined(PHP_WIN32_DEBUG_HEAP)
{ {
@ -651,6 +633,10 @@ int main(int argc, char *argv[])
setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */ setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */
#endif #endif
ini_entries_len = strlen(HARDCODED_INI);
cli_sapi_module.ini_entries = malloc(ini_entries_len+2);
memcpy(cli_sapi_module.ini_entries, HARDCODED_INI, ini_entries_len+1);
cli_sapi_module.ini_entries[ini_entries_len+1] = 0;
while ((c = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0))!=-1) { while ((c = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0))!=-1) {
switch (c) { switch (c) {
@ -660,6 +646,23 @@ int main(int argc, char *argv[])
case 'n': case 'n':
cli_sapi_module.php_ini_ignore = 1; cli_sapi_module.php_ini_ignore = 1;
break; break;
case 'd': {
/* define ini entries on command line */
int len = strlen(php_optarg);
if (strchr(php_optarg, '=')) {
cli_sapi_module.ini_entries = realloc(cli_sapi_module.ini_entries, ini_entries_len + len + sizeof("\n\0"));
memcpy(cli_sapi_module.ini_entries + ini_entries_len, php_optarg, len);
memcpy(cli_sapi_module.ini_entries + ini_entries_len + len, "\n\0", sizeof("\n\0"));
ini_entries_len += len + sizeof("\n\0") - 2;
} else {
cli_sapi_module.ini_entries = realloc(cli_sapi_module.ini_entries, ini_entries_len + len + sizeof("=1\n\0"));
memcpy(cli_sapi_module.ini_entries + ini_entries_len, php_optarg, len);
memcpy(cli_sapi_module.ini_entries + ini_entries_len + len, "=1\n\0", sizeof("=1\n\0"));
ini_entries_len += len + sizeof("=1\n\0") - 2;
}
break;
}
} }
} }
php_optind = orig_optind; php_optind = orig_optind;
@ -690,7 +693,6 @@ int main(int argc, char *argv[])
zend_first_try { zend_first_try {
zend_llist_init(&global_vars, sizeof(char *), NULL, 0); zend_llist_init(&global_vars, sizeof(char *), NULL, 0);
zend_uv.html_errors = 0; /* tell the engine we're in non-html mode */
CG(in_compilation) = 0; /* not initialized but needed for several options */ CG(in_compilation) = 0; /* not initialized but needed for several options */
EG(uninitialized_zval_ptr) = NULL; EG(uninitialized_zval_ptr) = NULL;
@ -700,20 +702,9 @@ int main(int argc, char *argv[])
goto out_err; goto out_err;
} }
/* here is the place for hard coded defaults which cannot be overwritten in the ini file */
INI_HARDCODED("register_argc_argv", "1");
INI_HARDCODED("html_errors", "0");
INI_HARDCODED("implicit_flush", "1");
INI_HARDCODED("output_buffering", "0");
INI_HARDCODED("max_execution_time", "0");
while ((c = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0)) != -1) { while ((c = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0)) != -1) {
switch (c) { switch (c) {
case 'd': /* define ini entries on command line */
define_command_line_ini_entry(php_optarg TSRMLS_CC);
break;
case 'h': /* help & quit */ case 'h': /* help & quit */
case '?': case '?':
if (php_request_startup(TSRMLS_C)==FAILURE) { if (php_request_startup(TSRMLS_C)==FAILURE) {
@ -1237,6 +1228,9 @@ int main(int argc, char *argv[])
if (cli_sapi_module.php_ini_path_override) { if (cli_sapi_module.php_ini_path_override) {
free(cli_sapi_module.php_ini_path_override); free(cli_sapi_module.php_ini_path_override);
} }
if (cli_sapi_module.ini_entries) {
free(cli_sapi_module.ini_entries);
}
} zend_end_try(); } zend_end_try();
out: out:
@ -1253,7 +1247,7 @@ out_err:
tsrm_shutdown(); tsrm_shutdown();
#endif #endif
exit(exit_status); return exit_status;
err: err:
zend_ini_deactivate(TSRMLS_C); zend_ini_deactivate(TSRMLS_C);

View file

@ -20,3 +20,13 @@ array(1) {
} }
} }
Done Done
--UEXPECT--
array(1) {
[123]=>
array(1) {
[0]=>
unicode(4) "SEGV"
}
}
Done

View file

@ -1,7 +1,7 @@
--TEST-- --TEST--
INI section allows '=' INI section allows '='
--INI-- --INI--
arg_separator.input== arg_separator.input="="
--FILE-- --FILE--
<?php <?php
var_dump(ini_get('arg_separator.input')); var_dump(ini_get('arg_separator.input'));