summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/date/php_date.c8
-rw-r--r--ext/mysql/php_mysql.c4
-rw-r--r--ext/reflection/php_reflection.c60
-rw-r--r--ext/spl/php_spl.c27
-rw-r--r--ext/spl/spl_directory.c22
-rw-r--r--ext/spl/spl_iterators.c35
-rw-r--r--ext/spl/spl_iterators.h2
-rw-r--r--ext/standard/array.c10
-rw-r--r--ext/standard/dir.c2
-rw-r--r--ext/standard/incomplete_class.c7
-rw-r--r--ext/standard/php_incomplete_class.h2
-rw-r--r--ext/standard/var.c8
12 files changed, 93 insertions, 94 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 9070c3ba4e..5164072104 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -3635,8 +3635,8 @@ PHP_METHOD(DateTimeZone, __construct)
tzobj->type = TIMELIB_ZONETYPE_ID;
tzobj->tzi.tz = tzi;
tzobj->initialized = 1;
- } else {
- ZVAL_NULL(getThis());
+//??? } else {
+//??? ZVAL_NULL(getThis());
}
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
@@ -4103,8 +4103,8 @@ PHP_METHOD(DateInterval, __construct)
diobj = Z_PHPINTERVAL_P(getThis());
diobj->diff = reltime;
diobj->initialized = 1;
- } else {
- ZVAL_NULL(getThis());
+//??? } else {
+//??? ZVAL_NULL(getThis());
}
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index eb34d442ac..40672f3ef6 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -2177,7 +2177,7 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
fci.function_table = &ce->function_table;
ZVAL_UNDEF(&fci.function_name);
fci.symbol_table = NULL;
- fci.object_ptr = return_value;
+ fci.object = Z_OBJ_P(return_value);
fci.retval = &retval;
if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) {
if (Z_TYPE_P(ctor_params) == IS_ARRAY) {
@@ -2212,7 +2212,7 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
fcc.function_handler = ce->constructor;
fcc.calling_scope = EG(scope);
fcc.called_scope = Z_OBJCE_P(return_value);
- ZVAL_COPY_VALUE(&fcc.object, return_value);
+ fcc.object = Z_OBJ_P(return_value);
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "Could not execute %s::%s()", ce->name->val, ce->constructor->common.function_name->val);
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 53101b4623..20d3eb0e73 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -83,7 +83,7 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection)
/* Method macros */
#define METHOD_NOTSTATIC(ce) \
- if (!this_ptr || !instanceof_function(Z_OBJCE_P(this_ptr), ce TSRMLS_CC)) { \
+ if (!Z_OBJ(EG(This)) || !instanceof_function(Z_OBJCE(EG(This)), ce TSRMLS_CC)) { \
php_error_docref(NULL TSRMLS_CC, E_ERROR, "%s() cannot be called statically", get_active_function_name(TSRMLS_C)); \
return; \
} \
@@ -624,7 +624,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
/* see if this is a closure */
if (ce == zend_ce_closure && obj && (len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
&& memcmp(mptr->common.function_name->val, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
- && (closure = zend_get_closure_invoke_method(obj TSRMLS_CC)) != NULL)
+ && (closure = zend_get_closure_invoke_method(Z_OBJ_P(obj) TSRMLS_CC)) != NULL)
{
mptr = closure;
} else {
@@ -1394,7 +1394,7 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
fci.function_table = NULL;
ZVAL_UNDEF(&fci.function_name);
fci.symbol_table = NULL;
- fci.object_ptr = &reflector;
+ fci.object = Z_OBJ(reflector);
fci.retval = &retval;
fci.param_count = ctor_argc;
fci.params = params;
@@ -1404,7 +1404,7 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
fcc.function_handler = ce_ptr->constructor;
fcc.calling_scope = ce_ptr;
fcc.called_scope = Z_OBJCE(reflector);
- ZVAL_COPY_VALUE(&fcc.object, &reflector);
+ fcc.object = Z_OBJ(reflector);
result = zend_call_function(&fci, &fcc TSRMLS_CC);
@@ -1426,7 +1426,7 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
ZVAL_STRINGL(&fci.function_name, "reflection::export", sizeof("reflection::export") - 1);
fci.function_table = &reflection_ptr->function_table;
- fci.object_ptr = NULL;
+ fci.object = NULL;
fci.retval = &retval;
fci.param_count = 2;
fci.params = params;
@@ -1910,7 +1910,7 @@ ZEND_METHOD(reflection_function, invoke)
fci.function_table = NULL;
ZVAL_UNDEF(&fci.function_name);
fci.symbol_table = NULL;
- fci.object_ptr = NULL;
+ fci.object = NULL;
fci.retval = &retval;
fci.param_count = num_args;
fci.params = params;
@@ -1920,7 +1920,7 @@ ZEND_METHOD(reflection_function, invoke)
fcc.function_handler = fptr;
fcc.calling_scope = EG(scope);
fcc.called_scope = NULL;
- ZVAL_UNDEF(&fcc.object);
+ fcc.object = NULL;
result = zend_call_function(&fci, &fcc TSRMLS_CC);
@@ -1974,7 +1974,7 @@ ZEND_METHOD(reflection_function, invokeArgs)
fci.function_table = NULL;
ZVAL_UNDEF(&fci.function_name);
fci.symbol_table = NULL;
- fci.object_ptr = NULL;
+ fci.object = NULL;
fci.retval = &retval;
fci.param_count = argc;
fci.params = params;
@@ -1984,7 +1984,7 @@ ZEND_METHOD(reflection_function, invokeArgs)
fcc.function_handler = fptr;
fcc.calling_scope = EG(scope);
fcc.called_scope = NULL;
- ZVAL_UNDEF(&fcc.object);
+ fcc.object = NULL;
result = zend_call_function(&fci, &fcc TSRMLS_CC);
@@ -2200,7 +2200,7 @@ ZEND_METHOD(reflection_parameter, __construct)
if (ce == zend_ce_closure && Z_TYPE_P(classref) == IS_OBJECT
&& (lcname_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
&& memcmp(lcname, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
- && (fptr = zend_get_closure_invoke_method(classref TSRMLS_CC)) != NULL)
+ && (fptr = zend_get_closure_invoke_method(Z_OBJ_P(classref) TSRMLS_CC)) != NULL)
{
/* nothing to do. don't set is_closure since is the invoke handler,
- not the closure itself */
@@ -2741,7 +2741,7 @@ ZEND_METHOD(reflection_method, __construct)
if (ce == zend_ce_closure && orig_obj && (name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
&& memcmp(lcname, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
- && (mptr = zend_get_closure_invoke_method(orig_obj TSRMLS_CC)) != NULL)
+ && (mptr = zend_get_closure_invoke_method(Z_OBJ_P(orig_obj) TSRMLS_CC)) != NULL)
{
/* do nothing, mptr already set */
} else if ((mptr = zend_hash_str_find_ptr(&ce->function_table, lcname, name_len)) == NULL) {
@@ -2821,7 +2821,7 @@ ZEND_METHOD(reflection_method, invoke)
{
zval retval;
zval *params = NULL;
- zval object;
+ zend_object *object;
reflection_object *intern;
zend_function *mptr;
int result, num_args = 0;
@@ -2862,7 +2862,7 @@ ZEND_METHOD(reflection_method, invoke)
* Else, we verify that the given object is an instance of the class.
*/
if (mptr->common.fn_flags & ZEND_ACC_STATIC) {
- ZVAL_UNDEF(&object);
+ object = NULL;
obj_ce = mptr->common.scope;
} else {
if (Z_TYPE(params[0]) != IS_OBJECT) {
@@ -2877,14 +2877,14 @@ ZEND_METHOD(reflection_method, invoke)
/* Returns from this function */
}
- ZVAL_COPY_VALUE(&object, &params[0]);
+ object = Z_OBJ(params[0]);
}
fci.size = sizeof(fci);
fci.function_table = NULL;
ZVAL_UNDEF(&fci.function_name);
fci.symbol_table = NULL;
- fci.object_ptr = &object;
+ fci.object = object;
fci.retval = &retval;
fci.param_count = num_args - 1;
fci.params = params + 1;
@@ -2894,7 +2894,7 @@ ZEND_METHOD(reflection_method, invoke)
fcc.function_handler = mptr;
fcc.calling_scope = obj_ce;
fcc.called_scope = intern->ce;
- ZVAL_COPY_VALUE(&fcc.object, &object);
+ fcc.object = object;
result = zend_call_function(&fci, &fcc TSRMLS_CC);
@@ -2989,7 +2989,7 @@ ZEND_METHOD(reflection_method, invokeArgs)
fci.function_table = NULL;
ZVAL_UNDEF(&fci.function_name);
fci.symbol_table = NULL;
- fci.object_ptr = object;
+ fci.object = object ? Z_OBJ_P(object) : NULL;
fci.retval = &retval;
fci.param_count = argc;
fci.params = params;
@@ -2999,11 +2999,7 @@ ZEND_METHOD(reflection_method, invokeArgs)
fcc.function_handler = mptr;
fcc.calling_scope = obj_ce;
fcc.called_scope = intern->ce;
- if (object) {
- ZVAL_COPY_VALUE(&fcc.object, object);
- } else {
- ZVAL_UNDEF(&fcc.object);
- }
+ fcc.object = (object) ? Z_OBJ_P(object) : NULL;
/*
* Copy the zend_function when calling via handler (e.g. Closure::__invoke())
@@ -3700,7 +3696,7 @@ ZEND_METHOD(reflection_class, getMethod)
lc_name = zend_str_tolower_dup(name, name_len);
if (ce == zend_ce_closure && !ZVAL_IS_UNDEF(&intern->obj) && (name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
&& memcmp(lc_name, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
- && (mptr = zend_get_closure_invoke_method(&intern->obj TSRMLS_CC)) != NULL)
+ && (mptr = zend_get_closure_invoke_method(Z_OBJ(intern->obj) TSRMLS_CC)) != NULL)
{
/* don't assign closure_object since we only reflect the invoke handler
method and not the closure definition itself */
@@ -3708,7 +3704,7 @@ ZEND_METHOD(reflection_class, getMethod)
efree(lc_name);
} else if (ce == zend_ce_closure && ZVAL_IS_UNDEF(&intern->obj) && (name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
&& memcmp(lc_name, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
- && object_init_ex(&obj_tmp, ce) == SUCCESS && (mptr = zend_get_closure_invoke_method(&obj_tmp TSRMLS_CC)) != NULL) {
+ && object_init_ex(&obj_tmp, ce) == SUCCESS && (mptr = zend_get_closure_invoke_method(Z_OBJ(obj_tmp) TSRMLS_CC)) != NULL) {
/* don't assign closure_object since we only reflect the invoke handler
method and not the closure definition itself */
reflection_method_factory(ce, mptr, NULL, return_value TSRMLS_CC);
@@ -3735,7 +3731,7 @@ static void _addmethod(zend_function *mptr, zend_class_entry *ce, zval *retval,
if (mptr->common.fn_flags & filter) {
if (ce == zend_ce_closure && obj && (len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
&& memcmp(mptr->common.function_name->val, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
- && (closure = zend_get_closure_invoke_method(obj TSRMLS_CC)) != NULL)
+ && (closure = zend_get_closure_invoke_method(Z_OBJ_P(obj) TSRMLS_CC)) != NULL)
{
mptr = closure;
}
@@ -3786,7 +3782,7 @@ ZEND_METHOD(reflection_class, getMethods)
array_init(return_value);
zend_hash_apply_with_arguments(&ce->function_table TSRMLS_CC, (apply_func_args_t) _addmethod_va, 4, &ce, return_value, filter, intern->obj);
if (Z_TYPE(intern->obj) != IS_UNDEF && instanceof_function(ce, zend_ce_closure TSRMLS_CC)) {
- zend_function *closure = zend_get_closure_invoke_method(&intern->obj TSRMLS_CC);
+ zend_function *closure = zend_get_closure_invoke_method(Z_OBJ(intern->obj) TSRMLS_CC);
if (closure) {
_addmethod(closure, ce, return_value, filter, &intern->obj TSRMLS_CC);
_free_function(closure TSRMLS_CC);
@@ -4198,7 +4194,7 @@ ZEND_METHOD(reflection_class, newInstance)
old_scope = EG(scope);
EG(scope) = ce;
- constructor = Z_OBJ_HT_P(return_value)->get_constructor(return_value TSRMLS_CC);
+ constructor = Z_OBJ_HT_P(return_value)->get_constructor(Z_OBJ_P(return_value) TSRMLS_CC);
EG(scope) = old_scope;
/* Run the constructor if there is one */
@@ -4223,7 +4219,7 @@ ZEND_METHOD(reflection_class, newInstance)
fci.function_table = EG(function_table);
ZVAL_UNDEF(&fci.function_name);
fci.symbol_table = NULL;
- fci.object_ptr = return_value;
+ fci.object = Z_OBJ_P(return_value);
fci.retval = &retval;
fci.param_count = num_args;
fci.params = params;
@@ -4233,7 +4229,7 @@ ZEND_METHOD(reflection_class, newInstance)
fcc.function_handler = constructor;
fcc.calling_scope = EG(scope);
fcc.called_scope = Z_OBJCE_P(return_value);
- ZVAL_COPY_VALUE(&fcc.object, return_value);
+ fcc.object = Z_OBJ_P(return_value);
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
if (!ZVAL_IS_UNDEF(&retval)) {
@@ -4297,7 +4293,7 @@ ZEND_METHOD(reflection_class, newInstanceArgs)
old_scope = EG(scope);
EG(scope) = ce;
- constructor = Z_OBJ_HT_P(return_value)->get_constructor(return_value TSRMLS_CC);
+ constructor = Z_OBJ_HT_P(return_value)->get_constructor(Z_OBJ_P(return_value) TSRMLS_CC);
EG(scope) = old_scope;
/* Run the constructor if there is one */
@@ -4322,7 +4318,7 @@ ZEND_METHOD(reflection_class, newInstanceArgs)
fci.function_table = EG(function_table);
ZVAL_UNDEF(&fci.function_name);
fci.symbol_table = NULL;
- fci.object_ptr = return_value;
+ fci.object = Z_OBJ_P(return_value);
fci.retval = &retval;
fci.param_count = argc;
fci.params = params;
@@ -4332,7 +4328,7 @@ ZEND_METHOD(reflection_class, newInstanceArgs)
fcc.function_handler = constructor;
fcc.calling_scope = EG(scope);
fcc.called_scope = Z_OBJCE_P(return_value);
- ZVAL_COPY_VALUE(&fcc.object, return_value);
+ fcc.object = Z_OBJ_P(return_value);
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
if (params) {
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index 935e64be60..55d72e6753 100644
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -485,7 +485,7 @@ PHP_FUNCTION(spl_autoload_register)
zend_bool prepend = 0;
zend_function *spl_func_ptr;
autoload_func_info alfi;
- zval *obj_ptr;
+ zend_object *obj_ptr;
zend_fcall_info_cache fcc;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "|zbb", &zcallable, &do_throw, &prepend) == FAILURE) {
@@ -496,9 +496,9 @@ PHP_FUNCTION(spl_autoload_register)
if (!zend_is_callable_ex(zcallable, NULL, IS_CALLABLE_STRICT, &func_name, &fcc, &error TSRMLS_CC)) {
alfi.ce = fcc.calling_scope;
alfi.func_ptr = fcc.function_handler;
- obj_ptr = &fcc.object;
+ obj_ptr = fcc.object;
if (Z_TYPE_P(zcallable) == IS_ARRAY) {
- if (Z_TYPE_P(obj_ptr) == IS_UNDEF && 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) {
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Passed array specifies a non static method but no object (%s)", error);
}
@@ -508,7 +508,7 @@ PHP_FUNCTION(spl_autoload_register)
STR_RELEASE(func_name);
RETURN_FALSE;
} else if (do_throw) {
- zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Passed array does not specify %s %smethod (%s)", alfi.func_ptr ? "a callable" : "an existing", Z_TYPE_P(obj_ptr) == IS_UNDEF ? "static " : "", error);
+ zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Passed array does not specify %s %smethod (%s)", alfi.func_ptr ? "a callable" : "an existing", !obj_ptr ? "static " : "", error);
}
if (error) {
efree(error);
@@ -547,7 +547,7 @@ PHP_FUNCTION(spl_autoload_register)
}
alfi.ce = fcc.calling_scope;
alfi.func_ptr = fcc.function_handler;
- obj_ptr = &fcc.object;
+ obj_ptr = fcc.object;
if (error) {
efree(error);
}
@@ -573,12 +573,13 @@ PHP_FUNCTION(spl_autoload_register)
goto skip;
}
- if (Z_TYPE_P(obj_ptr) == IS_OBJECT && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) {
+ if (obj_ptr && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) {
/* add object id to the hash to ensure uniqueness, for more reference look at bug #40091 */
lc_name = STR_REALLOC(lc_name, lc_name->len + sizeof(zend_uint), 0);
- memcpy(lc_name->val + lc_name->len - sizeof(zend_uint), &Z_OBJ_HANDLE_P(obj_ptr), sizeof(zend_uint));
+ memcpy(lc_name->val + lc_name->len - sizeof(zend_uint), &obj_ptr->handle, sizeof(zend_uint));
lc_name->val[lc_name->len] = '\0';
- ZVAL_COPY(&alfi.obj, obj_ptr);
+ ZVAL_OBJ(&alfi.obj, obj_ptr);
+ Z_ADDREF(alfi.obj);
} else {
ZVAL_UNDEF(&alfi.obj);
}
@@ -606,7 +607,7 @@ PHP_FUNCTION(spl_autoload_register)
}
if (zend_hash_add_mem(SPL_G(autoload_functions), lc_name, &alfi, sizeof(autoload_func_info)) == NULL) {
- if (Z_TYPE_P(obj_ptr) == IS_OBJECT && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) {
+ if (obj_ptr && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) {
Z_DELREF(alfi.obj);
}
if (!ZVAL_IS_UNDEF(&alfi.closure)) {
@@ -640,7 +641,7 @@ PHP_FUNCTION(spl_autoload_unregister)
zval *zcallable;
int success = FAILURE;
zend_function *spl_func_ptr;
- zval *obj_ptr;
+ zend_object *obj_ptr;
zend_fcall_info_cache fcc;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zcallable) == FAILURE) {
@@ -657,7 +658,7 @@ PHP_FUNCTION(spl_autoload_unregister)
}
RETURN_FALSE;
}
- obj_ptr = &fcc.object;
+ obj_ptr = fcc.object;
if (error) {
efree(error);
}
@@ -684,9 +685,9 @@ PHP_FUNCTION(spl_autoload_unregister)
} else {
/* remove specific */
success = zend_hash_del(SPL_G(autoload_functions), lc_name);
- if (success != SUCCESS && Z_TYPE_P(obj_ptr) == IS_OBJECT) {
+ if (success != SUCCESS && obj_ptr) {
lc_name = STR_REALLOC(lc_name, lc_name->len + sizeof(zend_uint), 0);
- memcpy(lc_name->val + lc_name->len - sizeof(zend_uint), &Z_OBJ_HANDLE_P(obj_ptr), sizeof(zend_uint));
+ memcpy(lc_name->val + lc_name->len - sizeof(zend_uint), &obj_ptr->handle, sizeof(zend_uint));
lc_name->val[lc_name->len] = '\0';
success = zend_hash_del(SPL_G(autoload_functions), lc_name);
}
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 86d745463f..8a60979307 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -578,9 +578,9 @@ static char *spl_filesystem_object_get_pathname(spl_filesystem_object *intern, i
}
/* }}} */
-static HashTable *spl_filesystem_object_get_debug_info(zval *obj, int *is_temp TSRMLS_DC) /* {{{ */
+static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */
{
- spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(obj);
+ spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(object);
zval tmp;
HashTable *rv;
zend_string *pnstr;
@@ -659,19 +659,19 @@ static HashTable *spl_filesystem_object_get_debug_info(zval *obj, int *is_temp T
}
/* }}} */
-zend_function *spl_filesystem_object_get_method_check(zval *object_ptr, zend_string *method, const struct _zend_literal *key TSRMLS_DC) /* {{{ */
+zend_function *spl_filesystem_object_get_method_check(zend_object **object, zend_string *method, const struct _zend_literal *key TSRMLS_DC) /* {{{ */
{
- spl_filesystem_object *fsobj = Z_SPLFILESYSTEM_P(object_ptr);
+ spl_filesystem_object *fsobj = spl_filesystem_from_obj(*object);
if (fsobj->u.dir.entry.d_name[0] == '\0' && fsobj->orig_path == NULL) {
zend_function *func;
zend_string *tmp = STR_INIT("_bad_state_ex", sizeof("_bad_state_ex") - 1, 0);
- func = zend_get_std_object_handlers()->get_method(object_ptr, tmp, NULL TSRMLS_CC);
+ func = zend_get_std_object_handlers()->get_method(object, tmp, NULL TSRMLS_CC);
STR_RELEASE(tmp);
return func;
}
- return zend_get_std_object_handlers()->get_method(object_ptr, method, key TSRMLS_CC);
+ return zend_get_std_object_handlers()->get_method(object, method, key TSRMLS_CC);
}
/* }}} */
@@ -828,12 +828,12 @@ SPL_METHOD(DirectoryIterator, seek)
if (intern->u.dir.index > pos) {
/* we first rewind */
- zend_call_method_with_0_params(this_ptr, Z_OBJCE_P(getThis()), &intern->u.dir.func_rewind, "rewind", NULL);
+ zend_call_method_with_0_params(&EG(This), Z_OBJCE(EG(This)), &intern->u.dir.func_rewind, "rewind", NULL);
}
while (intern->u.dir.index < pos) {
int valid = 0;
- zend_call_method_with_0_params(this_ptr, Z_OBJCE_P(getThis()), &intern->u.dir.func_valid, "valid", &retval);
+ zend_call_method_with_0_params(&EG(This), Z_OBJCE(EG(This)), &intern->u.dir.func_valid, "valid", &retval);
if (!ZVAL_IS_UNDEF(&retval)) {
valid = zend_is_true(&retval TSRMLS_CC);
zval_ptr_dtor(&retval);
@@ -841,7 +841,7 @@ SPL_METHOD(DirectoryIterator, seek)
if (!valid) {
break;
}
- zend_call_method_with_0_params(this_ptr, Z_OBJCE_P(getThis()), &intern->u.dir.func_next, "next", NULL);
+ zend_call_method_with_0_params(&EG(This), Z_OBJCE(EG(This)), &intern->u.dir.func_next, "next", NULL);
}
} /* }}} */
@@ -2091,7 +2091,7 @@ static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function
fci.size = sizeof(fci);
fci.function_table = EG(function_table);
- fci.object_ptr = NULL;
+ fci.object = NULL;
fci.retval = &retval;
fci.param_count = num_args;
fci.params = params;
@@ -2103,7 +2103,7 @@ static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function
fcic.function_handler = func_ptr;
fcic.calling_scope = NULL;
fcic.called_scope = NULL;
- ZVAL_UNDEF(&fcic.object);
+ fcic.object = NULL;
result = zend_call_function(&fci, &fcic TSRMLS_CC);
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 76dc200ee8..a1271dc070 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -829,24 +829,24 @@ SPL_METHOD(RecursiveIteratorIterator, getMaxDepth)
}
} /* }}} */
-static union _zend_function *spl_recursive_it_get_method(zval *object_ptr, zend_string *method, const zend_literal *key TSRMLS_DC)
+static union _zend_function *spl_recursive_it_get_method(zend_object **zobject, zend_string *method, const zend_literal *key TSRMLS_DC)
{
union _zend_function *function_handler;
- spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(object_ptr);
+ spl_recursive_it_object *object = spl_recursive_it_from_obj(*zobject);
long level = object->level;
zval *zobj;
if (!object->iterators) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "The %s instance wasn't initialized properly", Z_OBJCE_P(object_ptr)->name->val);
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "The %s instance wasn't initialized properly", zend_get_class_entry(*zobject TSRMLS_CC)->name->val);
}
zobj = &object->iterators[level].zobject;
- function_handler = std_object_handlers.get_method(object_ptr, method, key TSRMLS_CC);
+ function_handler = std_object_handlers.get_method(zobject, method, key TSRMLS_CC);
if (!function_handler) {
if ((function_handler = zend_hash_find_ptr(&Z_OBJCE_P(zobj)->function_table, method)) == NULL) {
if (Z_OBJ_HT_P(zobj)->get_method) {
- ZVAL_COPY_VALUE(object_ptr, zobj);
- function_handler = Z_OBJ_HT_P(object_ptr)->get_method(object_ptr, method, key TSRMLS_CC);
+ *zobject = Z_OBJ_P(zobj);
+ function_handler = (*zobject)->handlers->get_method(zobject, method, key TSRMLS_CC);
}
}
}
@@ -1276,22 +1276,22 @@ static int spl_dual_it_gets_implemented(zend_class_entry *interface, zend_class_
}
#endif
-static union _zend_function *spl_dual_it_get_method(zval *object_ptr, zend_string *method, const zend_literal *key TSRMLS_DC)
+static union _zend_function *spl_dual_it_get_method(zend_object **object, zend_string *method, const zend_literal *key TSRMLS_DC)
{
union _zend_function *function_handler;
spl_dual_it_object *intern;
- intern = Z_SPLDUAL_IT_P(object_ptr);
+ intern = spl_dual_it_from_obj(*object);
- function_handler = std_object_handlers.get_method(object_ptr, method, key TSRMLS_CC);
+ function_handler = std_object_handlers.get_method(object, method, key TSRMLS_CC);
if (!function_handler && intern->inner.ce) {
if ((function_handler = zend_hash_find_ptr(&intern->inner.ce->function_table, method)) == NULL) {
if (Z_OBJ_HT(intern->inner.zobject)->get_method) {
- ZVAL_COPY_VALUE(object_ptr, &intern->inner.zobject);
- function_handler = Z_OBJ_HT_P(object_ptr)->get_method(object_ptr, method, key TSRMLS_CC);
+ *object = Z_OBJ(intern->inner.zobject);
+ function_handler = (*object)->handlers->get_method(object, method, key TSRMLS_CC);
}
} else {
- ZVAL_COPY_VALUE(object_ptr, &intern->inner.zobject);
+ *object = Z_OBJ(intern->inner.zobject);
}
}
return function_handler;
@@ -1498,7 +1498,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
case DIT_CallbackFilterIterator:
case DIT_RecursiveCallbackFilterIterator: {
_spl_cbfilter_it_intern *cfi = emalloc(sizeof(*cfi));
- cfi->fci.object_ptr = NULL;
+ cfi->fci.object = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Of", &zobject, ce_inner, &cfi->fci, &cfi->fcc) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
efree(cfi);
@@ -1507,9 +1507,8 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
if (Z_REFCOUNTED_P(&cfi->fci.function_name)) {
Z_ADDREF(cfi->fci.function_name);
}
- if (Z_TYPE(cfi->fcc.object) == IS_OBJECT) {
- ZVAL_COPY(&cfi->object, &cfi->fcc.object);
- }
+ cfi->object = cfi->fcc.object;
+ if (cfi->object) cfi->object->gc.refcount++;
intern->u.cbfilter = cfi;
break;
}
@@ -2260,8 +2259,8 @@ static void spl_dual_it_free_storage(zend_object *_object TSRMLS_DC)
_spl_cbfilter_it_intern *cbfilter = object->u.cbfilter;
object->u.cbfilter = NULL;
zval_ptr_dtor(&cbfilter->fci.function_name);
- if (cbfilter->fci.object_ptr) {
- zval_ptr_dtor(cbfilter->fci.object_ptr);
+ if (cbfilter->fci.object) {
+ OBJ_RELEASE(cbfilter->fci.object);
}
efree(cbfilter);
}
diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h
index d20caad5ba..f51fc3a990 100644
--- a/ext/spl/spl_iterators.h
+++ b/ext/spl/spl_iterators.h
@@ -121,7 +121,7 @@ typedef enum {
typedef struct _spl_cbfilter_it_intern {
zend_fcall_info fci;
zend_fcall_info_cache fcc;
- zval object;
+ zend_object *object;
} _spl_cbfilter_it_intern;
typedef struct _spl_dual_it_object {
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 60df41f9cd..5e5fa73cd7 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -827,7 +827,7 @@ PHP_FUNCTION(end)
zend_hash_internal_pointer_end(array);
- if (return_value_used) {
+ if (USED_RET()) {
if ((entry = zend_hash_get_current_data(array)) == NULL) {
RETURN_FALSE;
}
@@ -850,7 +850,7 @@ PHP_FUNCTION(prev)
zend_hash_move_backwards(array);
- if (return_value_used) {
+ if (USED_RET()) {
if ((entry = zend_hash_get_current_data(array)) == NULL) {
RETURN_FALSE;
}
@@ -873,7 +873,7 @@ PHP_FUNCTION(next)
zend_hash_move_forward(array);
- if (return_value_used) {
+ if (USED_RET()) {
if ((entry = zend_hash_get_current_data(array)) == NULL) {
RETURN_FALSE;
}
@@ -896,7 +896,7 @@ PHP_FUNCTION(reset)
zend_hash_internal_pointer_reset(array);
- if (return_value_used) {
+ if (USED_RET()) {
if ((entry = zend_hash_get_current_data(array)) == NULL) {
RETURN_FALSE;
}
@@ -2126,7 +2126,7 @@ PHP_FUNCTION(array_splice)
/* Don't create the array of removed elements if it's not going
* to be used; e.g. only removing and/or replacing elements */
- if (return_value_used) {
+ if (USED_RET()) {
int size = length;
/* Clamp the offset.. */
diff --git a/ext/standard/dir.c b/ext/standard/dir.c
index 4744b16229..b305c9451b 100644
--- a/ext/standard/dir.c
+++ b/ext/standard/dir.c
@@ -80,7 +80,7 @@ static zend_class_entry *dir_class_entry_ptr;
} \
if (ZEND_NUM_ARGS() == 0) { \
myself = getThis(); \
- if (!ZVAL_IS_UNDEF(myself)) { \
+ if (myself) { \
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(myself), "handle", sizeof("handle")-1)) == NULL) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find my handle property"); \
RETURN_FALSE; \
diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c
index fc82eb8923..c017edff89 100644
--- a/ext/standard/incomplete_class.c
+++ b/ext/standard/incomplete_class.c
@@ -87,9 +87,12 @@ static int incomplete_class_has_property(zval *object, zval *member, int check_e
}
/* }}} */
-static union _zend_function *incomplete_class_get_method(zval *object, zend_string *method, const zend_literal *key TSRMLS_DC) /* {{{ */
+static union _zend_function *incomplete_class_get_method(zend_object **object, zend_string *method, const zend_literal *key TSRMLS_DC) /* {{{ */
{
- incomplete_class_message(object, E_ERROR TSRMLS_CC);
+ zval zobject;
+
+ ZVAL_OBJ(&zobject, *object);
+ incomplete_class_message(&zobject, E_ERROR TSRMLS_CC);
return NULL;
}
/* }}} */
diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h
index 9afc5d7d5b..804ca05206 100644
--- a/ext/standard/php_incomplete_class.h
+++ b/ext/standard/php_incomplete_class.h
@@ -36,7 +36,7 @@
} \
incomplete_class = 1; \
} else { \
- class_name = zend_get_object_classname(struc TSRMLS_CC); \
+ class_name = zend_get_object_classname(Z_OBJ_P(struc) TSRMLS_CC); \
}
#define PHP_CLEANUP_CLASS_ATTRIBUTES() \
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 9ea1119cea..8881b70079 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -166,7 +166,7 @@ again:
}
if (Z_OBJ_HANDLER_P(struc, get_class_name)) {
- class_name = Z_OBJ_HANDLER_P(struc, get_class_name)(struc, 0 TSRMLS_CC);
+ class_name = Z_OBJ_HANDLER_P(struc, get_class_name)(Z_OBJ_P(struc), 0 TSRMLS_CC);
php_printf("%sobject(%s)#%d (%d) {\n", COMMON, class_name->val, Z_OBJ_HANDLE_P(struc), myht ? zend_obj_num_elements(myht) : 0);
STR_RELEASE(class_name);
} else {
@@ -336,7 +336,7 @@ again:
PUTS("*RECURSION*\n");
return;
}
- class_name = Z_OBJ_HANDLER_P(struc, get_class_name)(struc, 0 TSRMLS_CC);
+ class_name = Z_OBJ_HANDLER_P(struc, get_class_name)(Z_OBJ_P(struc), 0 TSRMLS_CC);
php_printf("%sobject(%s)#%d (%d) refcount(%u){\n", COMMON, class_name->val, Z_OBJ_HANDLE_P(struc), myht ? zend_obj_num_elements(myht) : 0, Z_REFCOUNT_P(struc));
STR_RELEASE(class_name);
zval_element_dump_func = zval_object_property_dump;
@@ -552,7 +552,7 @@ again:
smart_str_appendc(buf, '\n');
buffer_append_spaces(buf, level - 1);
}
- class_name = Z_OBJ_HANDLER_P(struc, get_class_name)(struc, 0 TSRMLS_CC);
+ class_name = Z_OBJ_HANDLER_P(struc, get_class_name)(Z_OBJ_P(struc), 0 TSRMLS_CC);
smart_str_appendl(buf, class_name->val, class_name->len);
smart_str_appendl(buf, "::__set_state(array(\n", 21);
@@ -749,7 +749,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt
php_var_serialize_intern(buf, d, var_hash TSRMLS_CC);
} else {
zend_class_entry *ce;
- ce = zend_get_class_entry(struc TSRMLS_CC);
+ ce = zend_get_class_entry(Z_OBJ_P(struc) TSRMLS_CC);
if (ce) {
zend_string *prot_name, *priv_name;