summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/com_dotnet/com_handlers.c2
-rw-r--r--ext/date/php_date.c217
-rw-r--r--ext/dom/php_dom.c67
-rw-r--r--ext/dom/php_dom.h2
-rw-r--r--ext/ffi/ffi.c151
-rw-r--r--ext/gmp/gmp.c30
-rw-r--r--ext/hash/hash.c10
-rw-r--r--ext/intl/breakiterator/breakiterator_class.cpp10
-rw-r--r--ext/intl/calendar/calendar_class.cpp12
-rw-r--r--ext/intl/calendar/calendar_methods.cpp8
-rw-r--r--ext/intl/collator/collator_convert.c4
-rw-r--r--ext/intl/converter/converter.c6
-rw-r--r--ext/intl/dateformat/dateformat_class.c6
-rw-r--r--ext/intl/formatter/formatter_class.c6
-rw-r--r--ext/intl/msgformat/msgformat_class.c6
-rw-r--r--ext/intl/resourcebundle/resourcebundle_class.c13
-rw-r--r--ext/intl/spoofchecker/spoofchecker_class.c6
-rw-r--r--ext/intl/timezone/timezone_class.cpp12
-rw-r--r--ext/intl/transliterator/transliterator_class.c52
-rw-r--r--ext/json/json_parser.y4
-rw-r--r--ext/mysqli/mysqli.c59
-rw-r--r--ext/pdo/pdo_dbh.c12
-rw-r--r--ext/pdo/pdo_stmt.c127
-rw-r--r--ext/phar/phar_object.c12
-rw-r--r--ext/reflection/php_reflection.c44
-rw-r--r--ext/simplexml/simplexml.c100
-rw-r--r--ext/snmp/snmp.c52
-rw-r--r--ext/spl/spl_array.c144
-rw-r--r--ext/spl/spl_directory.c28
-rw-r--r--ext/spl/spl_dllist.c26
-rw-r--r--ext/spl/spl_engine.h4
-rw-r--r--ext/spl/spl_fixedarray.c42
-rw-r--r--ext/spl/spl_heap.c30
-rw-r--r--ext/spl/spl_iterators.c56
-rw-r--r--ext/spl/spl_observer.c56
-rw-r--r--ext/standard/array.c14
-rw-r--r--ext/standard/file.c2
-rw-r--r--ext/standard/incomplete_class.c30
-rw-r--r--ext/standard/php_incomplete_class.h4
-rw-r--r--ext/standard/user_filters.c8
-rw-r--r--ext/tidy/tidy.c12
-rw-r--r--ext/xmlreader/php_xmlreader.c53
-rw-r--r--ext/xsl/xsltprocessor.c18
-rw-r--r--ext/zip/php_zip.c63
44 files changed, 713 insertions, 907 deletions
diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c
index cd37718430..f542bafb60 100644
--- a/ext/com_dotnet/com_handlers.c
+++ b/ext/com_dotnet/com_handlers.c
@@ -461,7 +461,7 @@ static int com_objects_compare(zval *object1, zval *object2)
return ret;
}
-static int com_object_cast(zval *readobj, zval *writeobj, int type)
+static int com_object_cast(zend_object *readobj, zval *writeobj, int type)
{
php_com_dotnet_object *obj;
VARIANT v;
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index eb0ef5dc60..0c1ad6da70 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -642,28 +642,28 @@ static zend_object *date_object_new_timezone(zend_class_entry *class_type);
static zend_object *date_object_new_interval(zend_class_entry *class_type);
static zend_object *date_object_new_period(zend_class_entry *class_type);
-static zend_object *date_object_clone_date(zval *this_ptr);
-static zend_object *date_object_clone_timezone(zval *this_ptr);
-static zend_object *date_object_clone_interval(zval *this_ptr);
-static zend_object *date_object_clone_period(zval *this_ptr);
+static zend_object *date_object_clone_date(zend_object *this_ptr);
+static zend_object *date_object_clone_timezone(zend_object *this_ptr);
+static zend_object *date_object_clone_interval(zend_object *this_ptr);
+static zend_object *date_object_clone_period(zend_object *this_ptr);
static int date_object_compare_date(zval *d1, zval *d2);
-static HashTable *date_object_get_gc(zval *object, zval **table, int *n);
-static HashTable *date_object_get_properties_for(zval *object, zend_prop_purpose purpose);
-static HashTable *date_object_get_gc_interval(zval *object, zval **table, int *n);
-static HashTable *date_object_get_properties_interval(zval *object);
-static HashTable *date_object_get_gc_period(zval *object, zval **table, int *n);
-static HashTable *date_object_get_properties_period(zval *object);
-static HashTable *date_object_get_properties_for_timezone(zval *object, zend_prop_purpose purpose);
-static HashTable *date_object_get_gc_timezone(zval *object, zval **table, int *n);
-static HashTable *date_object_get_debug_info_timezone(zval *object, int *is_temp);
+static HashTable *date_object_get_gc(zend_object *object, zval **table, int *n);
+static HashTable *date_object_get_properties_for(zend_object *object, zend_prop_purpose purpose);
+static HashTable *date_object_get_gc_interval(zend_object *object, zval **table, int *n);
+static HashTable *date_object_get_properties_interval(zend_object *object);
+static HashTable *date_object_get_gc_period(zend_object *object, zval **table, int *n);
+static HashTable *date_object_get_properties_period(zend_object *object);
+static HashTable *date_object_get_properties_for_timezone(zend_object *object, zend_prop_purpose purpose);
+static HashTable *date_object_get_gc_timezone(zend_object *object, zval **table, int *n);
+static HashTable *date_object_get_debug_info_timezone(zend_object *object, int *is_temp);
static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv);
-zval *date_interval_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv);
-zval *date_interval_write_property(zval *object, zval *member, zval *value, void **cache_slot);
-static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot);
-static zval *date_period_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv);
-static zval *date_period_write_property(zval *object, zval *member, zval *value, void **cache_slot);
+zval *date_interval_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv);
+zval *date_interval_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot);
+static zval *date_interval_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot);
+static zval *date_period_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv);
+static zval *date_period_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot);
/* {{{ Module struct */
zend_module_entry date_module_entry = {
@@ -2022,31 +2022,21 @@ static int implement_date_interface_handler(zend_class_entry *interface, zend_cl
return SUCCESS;
} /* }}} */
-static int date_interval_has_property(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static int date_interval_has_property(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */
{
php_interval_obj *obj;
- zval tmp_member;
zval rv;
zval *prop;
int retval = 0;
- if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
- ZVAL_STR(&tmp_member, zval_get_string_func(member));
- member = &tmp_member;
- cache_slot = NULL;
- }
-
- obj = Z_PHPINTERVAL_P(object);
+ obj = php_interval_obj_from_obj(object);
if (!obj->initialized) {
- retval = zend_std_has_property(object, member, type, cache_slot);
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
+ retval = zend_std_has_property(object, name, type, cache_slot);
return retval;
}
- prop = date_interval_read_property(object, member, BP_VAR_IS, cache_slot, &rv);
+ prop = date_interval_read_property(object, name, BP_VAR_IS, cache_slot, &rv);
if (prop != &EG(uninitialized_zval)) {
if (type == 2) {
@@ -2057,11 +2047,7 @@ static int date_interval_has_property(zval *object, zval *member, int type, void
retval = (Z_TYPE_P(prop) != IS_NULL);
}
} else {
- retval = zend_std_has_property(object, member, type, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ retval = zend_std_has_property(object, name, type, cache_slot);
}
return retval;
@@ -2191,9 +2177,9 @@ static zend_object *date_object_new_date(zend_class_entry *class_type) /* {{{ */
return &intern->std;
} /* }}} */
-static zend_object *date_object_clone_date(zval *this_ptr) /* {{{ */
+static zend_object *date_object_clone_date(zend_object *this_ptr) /* {{{ */
{
- php_date_obj *old_obj = Z_PHPDATE_P(this_ptr);
+ php_date_obj *old_obj = php_date_obj_from_obj(this_ptr);
php_date_obj *new_obj = php_date_obj_from_obj(date_object_new_date(old_obj->std.ce));
zend_objects_clone_members(&new_obj->std, &old_obj->std);
@@ -2216,7 +2202,7 @@ static zend_object *date_object_clone_date(zval *this_ptr) /* {{{ */
static void date_clone_immutable(zval *object, zval *new_object) /* {{{ */
{
- ZVAL_OBJ(new_object, date_object_clone_date(object));
+ ZVAL_OBJ(new_object, date_object_clone_date(Z_OBJ_P(object)));
} /* }}} */
static int date_object_compare_date(zval *d1, zval *d2) /* {{{ */
@@ -2238,21 +2224,21 @@ static int date_object_compare_date(zval *d1, zval *d2) /* {{{ */
return timelib_time_compare(o1->time, o2->time);
} /* }}} */
-static HashTable *date_object_get_gc(zval *object, zval **table, int *n) /* {{{ */
+static HashTable *date_object_get_gc(zend_object *object, zval **table, int *n) /* {{{ */
{
*table = NULL;
*n = 0;
return zend_std_get_properties(object);
} /* }}} */
-static HashTable *date_object_get_gc_timezone(zval *object, zval **table, int *n) /* {{{ */
+static HashTable *date_object_get_gc_timezone(zend_object *object, zval **table, int *n) /* {{{ */
{
*table = NULL;
*n = 0;
return zend_std_get_properties(object);
} /* }}} */
-static HashTable *date_object_get_properties_for(zval *object, zend_prop_purpose purpose) /* {{{ */
+static HashTable *date_object_get_properties_for(zend_object *object, zend_prop_purpose purpose) /* {{{ */
{
HashTable *props;
zval zv;
@@ -2268,7 +2254,7 @@ static HashTable *date_object_get_properties_for(zval *object, zend_prop_purpose
return zend_std_get_properties_for(object, purpose);
}
- dateobj = Z_PHPDATE_P(object);
+ dateobj = php_date_obj_from_obj(object);
props = zend_array_dup(zend_std_get_properties(object));
if (!dateobj->time) {
return props;
@@ -2320,9 +2306,9 @@ static zend_object *date_object_new_timezone(zend_class_entry *class_type) /* {{
return &intern->std;
} /* }}} */
-static zend_object *date_object_clone_timezone(zval *this_ptr) /* {{{ */
+static zend_object *date_object_clone_timezone(zend_object *this_ptr) /* {{{ */
{
- php_timezone_obj *old_obj = Z_PHPTIMEZONE_P(this_ptr);
+ php_timezone_obj *old_obj = php_timezone_obj_from_obj(this_ptr);
php_timezone_obj *new_obj = php_timezone_obj_from_obj(date_object_new_timezone(old_obj->std.ce));
zend_objects_clone_members(&new_obj->std, &old_obj->std);
@@ -2373,7 +2359,7 @@ static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv)
}
}
-static HashTable *date_object_get_properties_for_timezone(zval *object, zend_prop_purpose purpose) /* {{{ */
+static HashTable *date_object_get_properties_for_timezone(zend_object *object, zend_prop_purpose purpose) /* {{{ */
{
HashTable *props;
zval zv;
@@ -2389,7 +2375,7 @@ static HashTable *date_object_get_properties_for_timezone(zval *object, zend_pro
return zend_std_get_properties_for(object, purpose);
}
- tzobj = Z_PHPTIMEZONE_P(object);
+ tzobj = php_timezone_obj_from_obj(object);
props = zend_array_dup(zend_std_get_properties(object));
if (!tzobj->initialized) {
return props;
@@ -2404,13 +2390,13 @@ static HashTable *date_object_get_properties_for_timezone(zval *object, zend_pro
return props;
} /* }}} */
-static HashTable *date_object_get_debug_info_timezone(zval *object, int *is_temp) /* {{{ */
+static HashTable *date_object_get_debug_info_timezone(zend_object *object, int *is_temp) /* {{{ */
{
HashTable *ht, *props;
zval zv;
php_timezone_obj *tzobj;
- tzobj = Z_PHPTIMEZONE_P(object);
+ tzobj = php_timezone_obj_from_obj(object);
props = zend_std_get_properties(object);
*is_temp = 1;
@@ -2436,9 +2422,9 @@ static zend_object *date_object_new_interval(zend_class_entry *class_type) /* {{
return &intern->std;
} /* }}} */
-static zend_object *date_object_clone_interval(zval *this_ptr) /* {{{ */
+static zend_object *date_object_clone_interval(zend_object *this_ptr) /* {{{ */
{
- php_interval_obj *old_obj = Z_PHPINTERVAL_P(this_ptr);
+ php_interval_obj *old_obj = php_interval_obj_from_obj(this_ptr);
php_interval_obj *new_obj = php_interval_obj_from_obj(date_object_new_interval(old_obj->std.ce));
zend_objects_clone_members(&new_obj->std, &old_obj->std);
@@ -2450,7 +2436,7 @@ static zend_object *date_object_clone_interval(zval *this_ptr) /* {{{ */
return &new_obj->std;
} /* }}} */
-static HashTable *date_object_get_gc_interval(zval *object, zval **table, int *n) /* {{{ */
+static HashTable *date_object_get_gc_interval(zend_object *object, zval **table, int *n) /* {{{ */
{
*table = NULL;
@@ -2458,13 +2444,13 @@ static HashTable *date_object_get_gc_interval(zval *object, zval **table, int *n
return zend_std_get_properties(object);
} /* }}} */
-static HashTable *date_object_get_properties_interval(zval *object) /* {{{ */
+static HashTable *date_object_get_properties_interval(zend_object *object) /* {{{ */
{
HashTable *props;
zval zv;
php_interval_obj *intervalobj;
- intervalobj = Z_PHPINTERVAL_P(object);
+ intervalobj = php_interval_obj_from_obj(object);
props = zend_std_get_properties(object);
if (!intervalobj->initialized) {
return props;
@@ -2512,9 +2498,9 @@ static zend_object *date_object_new_period(zend_class_entry *class_type) /* {{{
return &intern->std;
} /* }}} */
-static zend_object *date_object_clone_period(zval *this_ptr) /* {{{ */
+static zend_object *date_object_clone_period(zend_object *this_ptr) /* {{{ */
{
- php_period_obj *old_obj = Z_PHPPERIOD_P(this_ptr);
+ php_period_obj *old_obj = php_period_obj_from_obj(this_ptr);
php_period_obj *new_obj = php_period_obj_from_obj(date_object_new_period(old_obj->std.ce));
zend_objects_clone_members(&new_obj->std, &old_obj->std);
@@ -4137,34 +4123,24 @@ static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *forma
} /* }}} */
/* {{{ date_interval_read_property */
-zval *date_interval_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+zval *date_interval_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
php_interval_obj *obj;
zval *retval;
- zval tmp_member;
timelib_sll value = -1;
double fvalue = -1;
- if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_STR(&tmp_member, zval_get_string_func(member));
- member = &tmp_member;
- cache_slot = NULL;
- }
-
- obj = Z_PHPINTERVAL_P(object);
+ obj = php_interval_obj_from_obj(object);
if (!obj->initialized) {
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
return retval;
}
#define GET_VALUE_FROM_STRUCT(n,m) \
- if (strcmp(Z_STRVAL_P(member), m) == 0) { \
- value = obj->diff->n; \
- break; \
+ if (strcmp(ZSTR_VAL(name), m) == 0) { \
+ value = obj->diff->n; \
+ break; \
}
do {
GET_VALUE_FROM_STRUCT(y, "y");
@@ -4173,18 +4149,14 @@ zval *date_interval_read_property(zval *object, zval *member, int type, void **c
GET_VALUE_FROM_STRUCT(h, "h");
GET_VALUE_FROM_STRUCT(i, "i");
GET_VALUE_FROM_STRUCT(s, "s");
- if (strcmp(Z_STRVAL_P(member), "f") == 0) {
+ if (strcmp(ZSTR_VAL(name), "f") == 0) {
fvalue = obj->diff->us / 1000000.0;
break;
}
GET_VALUE_FROM_STRUCT(invert, "invert");
GET_VALUE_FROM_STRUCT(days, "days");
/* didn't find any */
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
return retval;
} while(0);
@@ -4199,38 +4171,23 @@ zval *date_interval_read_property(zval *object, zval *member, int type, void **c
ZVAL_FALSE(retval);
}
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
-
return retval;
}
/* }}} */
/* {{{ date_interval_write_property */
-zval *date_interval_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+zval *date_interval_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
php_interval_obj *obj;
- zval tmp_member;
-
- if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_STR(&tmp_member, zval_get_string_func(member));
- member = &tmp_member;
- cache_slot = NULL;
- }
- obj = Z_PHPINTERVAL_P(object);
+ obj = php_interval_obj_from_obj(object);
if (!obj->initialized) {
- value = zend_std_write_property(object, member, value, cache_slot);
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
- return value;
+ return zend_std_write_property(object, name, value, cache_slot);
}
-#define SET_VALUE_FROM_STRUCT(n,m) \
- if (strcmp(Z_STRVAL_P(member), m) == 0) { \
+#define SET_VALUE_FROM_STRUCT(n,m) \
+ if (strcmp(ZSTR_VAL(name), m) == 0) { \
obj->diff->n = zval_get_long(value); \
break; \
}
@@ -4242,51 +4199,37 @@ zval *date_interval_write_property(zval *object, zval *member, zval *value, void
SET_VALUE_FROM_STRUCT(h, "h");
SET_VALUE_FROM_STRUCT(i, "i");
SET_VALUE_FROM_STRUCT(s, "s");
- if (strcmp(Z_STRVAL_P(member), "f") == 0) {
+ if (strcmp(ZSTR_VAL(name), "f") == 0) {
obj->diff->us = zval_get_double(value) * 1000000;
break;
}
SET_VALUE_FROM_STRUCT(invert, "invert");
/* didn't find any */
- value = zend_std_write_property(object, member, value, cache_slot);
+ value = zend_std_write_property(object, name, value, cache_slot);
} while(0);
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
-
return value;
}
/* }}} */
/* {{{ date_interval_get_property_ptr_ptr */
-static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot)
-{
- zval tmp_member, *ret;
-
- if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_STR(&tmp_member, zval_get_string_func(member));
- member = &tmp_member;
- cache_slot = NULL;
- }
-
- if(zend_binary_strcmp("y", sizeof("y") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("m", sizeof("m") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("d", sizeof("d") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("h", sizeof("h") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("i", sizeof("i") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("s", sizeof("s") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("f", sizeof("f") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("days", sizeof("days") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("invert", sizeof("invert") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0) {
+static zval *date_interval_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot)
+{
+ zval *ret;
+
+ if(zend_binary_strcmp("y", sizeof("y") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("m", sizeof("m") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("d", sizeof("d") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("h", sizeof("h") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("i", sizeof("i") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("s", sizeof("s") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("f", sizeof("f") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("days", sizeof("days") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("invert", sizeof("invert") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0) {
/* Fallback to read_property. */
ret = NULL;
} else {
- ret = zend_std_get_property_ptr_ptr(object, member, type, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ ret = zend_std_get_property_ptr_ptr(object, name, type, cache_slot);
}
return ret;
@@ -5082,20 +5025,20 @@ PHP_FUNCTION(date_sun_info)
}
/* }}} */
-static HashTable *date_object_get_gc_period(zval *object, zval **table, int *n) /* {{{ */
+static HashTable *date_object_get_gc_period(zend_object *object, zval **table, int *n) /* {{{ */
{
*table = NULL;
*n = 0;
return zend_std_get_properties(object);
} /* }}} */
-static HashTable *date_object_get_properties_period(zval *object) /* {{{ */
+static HashTable *date_object_get_properties_period(zend_object *object) /* {{{ */
{
HashTable *props;
zval zv;
php_period_obj *period_obj;
- period_obj = Z_PHPPERIOD_P(object);
+ period_obj = php_period_obj_from_obj(object);
props = zend_std_get_properties(object);
if (!period_obj->start) {
return props;
@@ -5273,7 +5216,7 @@ PHP_METHOD(DatePeriod, __wakeup)
/* }}} */
/* {{{ date_period_read_property */
-static zval *date_period_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+static zval *date_period_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
zval *zv;
if (type != BP_VAR_IS && type != BP_VAR_R) {
@@ -5281,12 +5224,12 @@ static zval *date_period_read_property(zval *object, zval *member, int type, voi
return &EG(uninitialized_zval);
}
- Z_OBJPROP_P(object); /* build properties hash table */
+ object->handlers->get_properties(object); /* build properties hash table */
- zv = zend_std_read_property(object, member, type, cache_slot, rv);
+ zv = zend_std_read_property(object, name, type, cache_slot, rv);
if (Z_TYPE_P(zv) == IS_OBJECT && Z_OBJ_HANDLER_P(zv, clone_obj)) {
/* defensive copy */
- ZVAL_OBJ(zv, Z_OBJ_HANDLER_P(zv, clone_obj)(zv));
+ ZVAL_OBJ(zv, Z_OBJ_HANDLER_P(zv, clone_obj)(Z_OBJ_P(zv)));
}
return zv;
@@ -5294,7 +5237,7 @@ static zval *date_period_read_property(zval *object, zval *member, int type, voi
/* }}} */
/* {{{ date_period_write_property */
-static zval *date_period_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+static zval *date_period_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
zend_throw_error(NULL, "Writing to DatePeriod properties is unsupported");
return value;
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index 726b74b934..1a3689926b 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -310,31 +310,27 @@ static void dom_register_prop_handler(HashTable *prop_handler, char *name, size_
}
/* }}} */
-static zval *dom_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static zval *dom_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */
{
- dom_object *obj = Z_DOMOBJ_P(object);
- zend_string *member_str = zval_get_string(member);
+ dom_object *obj = php_dom_obj_from_obj(object);
zval *retval = NULL;
- if (!obj->prop_handler || !zend_hash_exists(obj->prop_handler, member_str)) {
- retval = zend_std_get_property_ptr_ptr(object, member, type, cache_slot);
+ if (!obj->prop_handler || !zend_hash_exists(obj->prop_handler, name)) {
+ retval = zend_std_get_property_ptr_ptr(object, name, type, cache_slot);
}
-
- zend_string_release_ex(member_str, 0);
return retval;
}
/* }}} */
/* {{{ dom_read_property */
-zval *dom_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+zval *dom_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
- dom_object *obj = Z_DOMOBJ_P(object);
- zend_string *member_str = zval_get_string(member);
+ dom_object *obj = php_dom_obj_from_obj(object);
zval *retval;
dom_prop_handler *hnd = NULL;
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, member_str);
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
} else if (instanceof_function(obj->std.ce, dom_node_class_entry)) {
php_error(E_WARNING, "Couldn't fetch %s. Node no longer exists", ZSTR_VAL(obj->std.ce->name));
}
@@ -347,46 +343,41 @@ zval *dom_read_property(zval *object, zval *member, int type, void **cache_slot,
retval = &EG(uninitialized_zval);
}
} else {
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
}
- zend_string_release_ex(member_str, 0);
return retval;
}
/* }}} */
/* {{{ dom_write_property */
-zval *dom_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+zval *dom_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- dom_object *obj = Z_DOMOBJ_P(object);
- zend_string *member_str = zval_get_string(member);
+ dom_object *obj = php_dom_obj_from_obj(object);
dom_prop_handler *hnd = NULL;
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, member_str);
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd) {
hnd->write_func(obj, value);
} else {
- value = zend_std_write_property(object, member, value, cache_slot);
+ value = zend_std_write_property(object, name, value, cache_slot);
}
- zend_string_release_ex(member_str, 0);
-
return value;
}
/* }}} */
/* {{{ dom_property_exists */
-static int dom_property_exists(zval *object, zval *member, int check_empty, void **cache_slot)
+static int dom_property_exists(zend_object *object, zend_string *name, int check_empty, void **cache_slot)
{
- dom_object *obj = Z_DOMOBJ_P(object);
- zend_string *member_str = zval_get_string(member);
+ dom_object *obj = php_dom_obj_from_obj(object);
dom_prop_handler *hnd = NULL;
int retval = 0;
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, member_str);
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd) {
zval tmp;
@@ -402,17 +393,16 @@ static int dom_property_exists(zval *object, zval *member, int check_empty, void
zval_ptr_dtor(&tmp);
}
} else {
- retval = zend_std_has_property(object, member, check_empty, cache_slot);
+ retval = zend_std_has_property(object, name, check_empty, cache_slot);
}
- zend_string_release_ex(member_str, 0);
return retval;
}
/* }}} */
-static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp) /* {{{ */
+static HashTable* dom_get_debug_info_helper(zend_object *object, int *is_temp) /* {{{ */
{
- dom_object *obj = Z_DOMOBJ_P(object);
+ dom_object *obj = php_dom_obj_from_obj(object);
HashTable *debug_info,
*prop_handlers = obj->prop_handler,
*std_props;
@@ -453,7 +443,7 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp) /* {{{ *
}
/* }}} */
-static HashTable* dom_get_debug_info(zval *object, int *is_temp) /* {{{ */
+static HashTable* dom_get_debug_info(zend_object *object, int *is_temp) /* {{{ */
{
return dom_get_debug_info_helper(object, is_temp);
}
@@ -500,9 +490,9 @@ PHP_FUNCTION(dom_import_simplexml)
static dom_object* dom_objects_set_class(zend_class_entry *class_type);
-static zend_object *dom_objects_store_clone_obj(zval *zobject) /* {{{ */
+static zend_object *dom_objects_store_clone_obj(zend_object *zobject) /* {{{ */
{
- dom_object *intern = Z_DOMOBJ_P(zobject);
+ dom_object *intern = php_dom_obj_from_obj(zobject);
dom_object *clone = dom_objects_set_class(intern->std.ce);
clone->std.handlers = dom_get_obj_handlers();
@@ -583,7 +573,9 @@ ZEND_GET_MODULE(dom)
void dom_objects_free_storage(zend_object *object);
void dom_nnodemap_objects_free_storage(zend_object *object);
-static zend_object *dom_objects_store_clone_obj(zval *zobject);
+static zval *dom_nodelist_read_dimension(zend_object *object, zval *offset, int type, zval *rv);
+static int dom_nodelist_has_dimension(zend_object *object, zval *member, int check_empty);
+static zend_object *dom_objects_store_clone_obj(zend_object *zobject);
static void dom_nnodemap_object_dtor(zend_object *object);
#if defined(LIBXML_XPATH_ENABLED)
void dom_xpath_objects_free_storage(zend_object *object);
@@ -1530,7 +1522,7 @@ xmlNsPtr dom_get_nsdecl(xmlNode *node, xmlChar *localName) {
}
/* }}} end dom_get_nsdecl */
-zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
+static zval *dom_nodelist_read_dimension(zend_object *object, zval *offset, int type, zval *rv) /* {{{ */
{
zval offset_copy;
@@ -1540,12 +1532,12 @@ zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type, zval *rv
ZVAL_LONG(&offset_copy, zval_get_long(offset));
- zend_call_method_with_1_params(object, Z_OBJCE_P(object), NULL, "item", rv, &offset_copy);
+ zend_call_method_with_1_params(object, object->ce, NULL, "item", rv, &offset_copy);
return rv;
} /* }}} end dom_nodelist_read_dimension */
-int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty)
+static int dom_nodelist_has_dimension(zend_object *object, zval *member, int check_empty)
{
zend_long offset = zval_get_long(member);
zval rv;
@@ -1553,8 +1545,11 @@ int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty)
if (offset < 0) {
return 0;
} else {
- zval *length = zend_read_property(Z_OBJCE_P(object), object, "length", sizeof("length") - 1, 0, &rv);
+ zval obj;
+ zval *length;
+ ZVAL_OBJ(&obj, object);
+ length = zend_read_property(object->ce, &obj, "length", sizeof("length") - 1, 0, &rv);
return length && offset < Z_LVAL_P(length);
}
} /* }}} end dom_nodelist_has_dimension */
diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h
index ce377b5ce7..c3b24c8691 100644
--- a/ext/dom/php_dom.h
+++ b/ext/dom/php_dom.h
@@ -125,8 +125,6 @@ xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index);
xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index);
zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, int by_ref);
void dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_class_entry *ce);
-zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type, zval *rv);
-int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty);
#define REGISTER_DOM_CLASS(ce, name, parent_ce, funcs, entry) \
INIT_CLASS_ENTRY(ce, name, funcs); \
diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c
index 1a8f866520..715628b5e5 100644
--- a/ext/ffi/ffi.c
+++ b/ext/ffi/ffi.c
@@ -880,9 +880,9 @@ static void *zend_ffi_create_callback(zend_ffi_type *type, zval *value) /* {{{ *
/* }}} */
#endif
-static zval* zend_ffi_cdata_get(zval *object, zval *rv) /* {{{ */
+static zval* zend_ffi_cdata_get(zend_object *obj, zval *rv) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
#if 0
@@ -897,9 +897,9 @@ static zval* zend_ffi_cdata_get(zval *object, zval *rv) /* {{{ */
}
/* }}} */
-static void zend_ffi_cdata_set(zval *object, zval *value) /* {{{ */
+static void zend_ffi_cdata_set(zend_object *obj, zval *value) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
#if 0
@@ -913,15 +913,15 @@ static void zend_ffi_cdata_set(zval *object, zval *value) /* {{{ */
}
/* }}} */
-static int zend_ffi_cdata_cast_object(zval *readobj, zval *writeobj, int type) /* {{{ */
+static int zend_ffi_cdata_cast_object(zend_object *readobj, zval *writeobj, int type) /* {{{ */
{
return FAILURE;
}
/* }}} */
-static zval *zend_ffi_cdata_read_field(zval *object, zval *member, int read_type, void **cache_slot, zval *rv) /* {{{ */
+static zval *zend_ffi_cdata_read_field(zend_object *obj, zend_string *field_name, int read_type, void **cache_slot, zval *rv) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
void *ptr = cdata->ptr;
zend_ffi_field *field;
@@ -929,28 +929,22 @@ static zval *zend_ffi_cdata_read_field(zval *object, zval *member, int read_type
if (cache_slot && *cache_slot == type) {
field = *(cache_slot + 1);
} else {
- zend_string *tmp_field_name;
- zend_string *field_name = zval_get_tmp_string(member, &tmp_field_name);
-
if (UNEXPECTED(type->kind != ZEND_FFI_TYPE_STRUCT)) {
if (type->kind == ZEND_FFI_TYPE_POINTER) {
/* transparently dereference the pointer */
if (UNEXPECTED(!ptr)) {
zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference");
- zend_tmp_string_release(tmp_field_name);
return &EG(uninitialized_zval);
}
ptr = (void*)(*(char**)ptr);
if (UNEXPECTED(!ptr)) {
zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference");
- zend_tmp_string_release(tmp_field_name);
return &EG(uninitialized_zval);
}
type = ZEND_FFI_TYPE(type->pointer.type);
}
if (UNEXPECTED(type->kind != ZEND_FFI_TYPE_STRUCT)) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to read field '%s' of non C struct/union", ZSTR_VAL(field_name));
- zend_tmp_string_release(tmp_field_name);
return &EG(uninitialized_zval);
}
}
@@ -958,12 +952,9 @@ static zval *zend_ffi_cdata_read_field(zval *object, zval *member, int read_type
field = zend_hash_find_ptr(&type->record.fields, field_name);
if (UNEXPECTED(!field)) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to read undefined field '%s' of C struct/union", ZSTR_VAL(field_name));
- zend_tmp_string_release(tmp_field_name);
return &EG(uninitialized_zval);
}
- zend_tmp_string_release(tmp_field_name);
-
if (cache_slot) {
*cache_slot = type;
*(cache_slot + 1) = field;
@@ -997,9 +988,9 @@ static zval *zend_ffi_cdata_read_field(zval *object, zval *member, int read_type
}
/* }}} */
-static zval *zend_ffi_cdata_write_field(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static zval *zend_ffi_cdata_write_field(zend_object *obj, zend_string *field_name, zval *value, void **cache_slot) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
void *ptr = cdata->ptr;
zend_ffi_field *field;
@@ -1007,28 +998,22 @@ static zval *zend_ffi_cdata_write_field(zval *object, zval *member, zval *value,
if (cache_slot && *cache_slot == type) {
field = *(cache_slot + 1);
} else {
- zend_string *tmp_field_name;
- zend_string *field_name = zval_get_tmp_string(member, &tmp_field_name);
-
if (UNEXPECTED(type->kind != ZEND_FFI_TYPE_STRUCT)) {
if (type->kind == ZEND_FFI_TYPE_POINTER) {
/* transparently dereference the pointer */
if (UNEXPECTED(!ptr)) {
zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference");
- zend_tmp_string_release(tmp_field_name);
return value;
}
ptr = (void*)(*(char**)ptr);
if (UNEXPECTED(!ptr)) {
zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference");
- zend_tmp_string_release(tmp_field_name);
return value;
}
type = ZEND_FFI_TYPE(type->pointer.type);
}
if (UNEXPECTED(type->kind != ZEND_FFI_TYPE_STRUCT)) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to assign field '%s' of non C struct/union", ZSTR_VAL(field_name));
- zend_tmp_string_release(tmp_field_name);
return value;
}
}
@@ -1036,12 +1021,9 @@ static zval *zend_ffi_cdata_write_field(zval *object, zval *member, zval *value,
field = zend_hash_find_ptr(&type->record.fields, field_name);
if (UNEXPECTED(!field)) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to assign undefined field '%s' of C struct/union", ZSTR_VAL(field_name));
- zend_tmp_string_release(tmp_field_name);
return value;
}
- zend_tmp_string_release(tmp_field_name);
-
if (cache_slot) {
*cache_slot = type;
*(cache_slot + 1) = field;
@@ -1059,10 +1041,7 @@ static zval *zend_ffi_cdata_write_field(zval *object, zval *member, zval *value,
zend_throw_error(zend_ffi_exception_ce, "Attempt to assign read-only location");
return value;
} else if (UNEXPECTED(field->is_const)) {
- zend_string *tmp_field_name;
- zend_string *field_name = zval_get_tmp_string(member, &tmp_field_name);
zend_throw_error(zend_ffi_exception_ce, "Attempt to assign read-only field '%s'", ZSTR_VAL(field_name));
- zend_tmp_string_release(tmp_field_name);
return value;
}
@@ -1076,9 +1055,9 @@ static zval *zend_ffi_cdata_write_field(zval *object, zval *member, zval *value,
}
/* }}} */
-static zval *zend_ffi_cdata_read_dim(zval *object, zval *offset, int read_type, zval *rv) /* {{{ */
+static zval *zend_ffi_cdata_read_dim(zend_object *obj, zval *offset, int read_type, zval *rv) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
zend_long dim = zval_get_long(offset);
zend_ffi_type *dim_type;
@@ -1134,9 +1113,9 @@ static zval *zend_ffi_cdata_read_dim(zval *object, zval *offset, int read_type,
}
/* }}} */
-static void zend_ffi_cdata_write_dim(zval *object, zval *offset, zval *value) /* {{{ */
+static void zend_ffi_cdata_write_dim(zend_object *obj, zval *offset, zval *value) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
zend_long dim = zval_get_long(offset);
void *ptr;
@@ -1388,9 +1367,9 @@ static int zend_ffi_cdata_compare_objects(zval *o1, zval *o2) /* {{{ */
}
/* }}} */
-static int zend_ffi_cdata_count_elements(zval *object, zend_long *count) /* {{{ */
+static int zend_ffi_cdata_count_elements(zend_object *obj, zend_long *count) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
if (type->kind != ZEND_FFI_TYPE_ARRAY) {
@@ -1640,9 +1619,9 @@ static zend_object_iterator *zend_ffi_cdata_get_iterator(zend_class_entry *ce, z
}
/* }}} */
-static HashTable *zend_ffi_cdata_get_debug_info(zval *object, int *is_temp) /* {{{ */
+static HashTable *zend_ffi_cdata_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
void *ptr = cdata->ptr;
HashTable *ht = NULL;
@@ -1739,9 +1718,9 @@ static HashTable *zend_ffi_cdata_get_debug_info(zval *object, int *is_temp) /* {
}
/* }}} */
-static int zend_ffi_cdata_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr) /* {{{ */
+static int zend_ffi_cdata_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(obj);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
zend_function *func;
@@ -1870,7 +1849,7 @@ static int zend_ffi_ctype_compare_objects(zval *o1, zval *o2) /* {{{ */
}
/* }}} */
-static HashTable *zend_ffi_ctype_get_debug_info(zval *object, int *is_temp) /* {{{ */
+static HashTable *zend_ffi_ctype_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
return NULL;
}
@@ -2038,9 +2017,9 @@ static void zend_ffi_cdata_free_obj(zend_object *object) /* {{{ */
}
/* }}} */
-static zend_object *zend_ffi_cdata_clone_obj(zval *zobject) /* {{{ */
+static zend_object *zend_ffi_cdata_clone_obj(zend_object *obj) /* {{{ */
{
- zend_ffi_cdata *old_cdata = (zend_ffi_cdata*)Z_OBJ_P(zobject);
+ zend_ffi_cdata *old_cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(old_cdata->type);
zend_ffi_cdata *new_cdata;
@@ -2057,11 +2036,9 @@ static zend_object *zend_ffi_cdata_clone_obj(zval *zobject) /* {{{ */
}
/* }}} */
-static zval *zend_ffi_read_var(zval *object, zval *member, int read_type, void **cache_slot, zval *rv) /* {{{ */
+static zval *zend_ffi_read_var(zend_object *obj, zend_string *var_name, int read_type, void **cache_slot, zval *rv) /* {{{ */
{
- zend_ffi *ffi = (zend_ffi*)Z_OBJ_P(object);
- zend_string *tmp_var_name;
- zend_string *var_name = zval_get_tmp_string(member, &tmp_var_name);
+ zend_ffi *ffi = (zend_ffi*)obj;
zend_ffi_symbol *sym = NULL;
if (ffi->symbols) {
@@ -2072,12 +2049,9 @@ static zval *zend_ffi_read_var(zval *object, zval *member, int read_type, void *
}
if (!sym) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to read undefined C variable '%s'", ZSTR_VAL(var_name));
- zend_tmp_string_release(tmp_var_name);
return &EG(uninitialized_zval);
}
- zend_tmp_string_release(tmp_var_name);
-
if (sym->kind == ZEND_FFI_SYM_VAR) {
zend_ffi_cdata_to_zval(NULL, sym->addr, ZEND_FFI_TYPE(sym->type), read_type, rv, (zend_ffi_flags)sym->is_const, 0);
} else {
@@ -2088,11 +2062,9 @@ static zval *zend_ffi_read_var(zval *object, zval *member, int read_type, void *
}
/* }}} */
-static zval *zend_ffi_write_var(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static zval *zend_ffi_write_var(zend_object *obj, zend_string *var_name, zval *value, void **cache_slot) /* {{{ */
{
- zend_ffi *ffi = (zend_ffi*)Z_OBJ_P(object);
- zend_string *tmp_var_name;
- zend_string *var_name = zval_get_tmp_string(member, &tmp_var_name);
+ zend_ffi *ffi = (zend_ffi*)obj;
zend_ffi_symbol *sym = NULL;
if (ffi->symbols) {
@@ -2103,12 +2075,9 @@ static zval *zend_ffi_write_var(zval *object, zval *member, zval *value, void **
}
if (!sym) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to assign undefined C variable '%s'", ZSTR_VAL(var_name));
- zend_tmp_string_release(tmp_var_name);
return value;
}
- zend_tmp_string_release(tmp_var_name);
-
if (sym->is_const) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to assign read-only C variable '%s'", ZSTR_VAL(var_name));
return value;
@@ -4270,33 +4239,29 @@ static ZEND_COLD zend_never_inline void zend_bad_array_access(zend_class_entry *
}
/* }}} */
-static ZEND_COLD zval *zend_fake_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
+static ZEND_COLD zval *zend_fake_read_dimension(zend_object *obj, zval *offset, int type, zval *rv) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
return NULL;
}
/* }}} */
-static ZEND_COLD void zend_fake_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */
+static ZEND_COLD void zend_fake_write_dimension(zend_object *obj, zval *offset, zval *value) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
}
/* }}} */
-static ZEND_COLD int zend_fake_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */
+static ZEND_COLD int zend_fake_has_dimension(zend_object *obj, zval *offset, int check_empty) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
return 0;
}
/* }}} */
-static ZEND_COLD void zend_fake_unset_dimension(zval *object, zval *offset) /* {{{ */
+static ZEND_COLD void zend_fake_unset_dimension(zend_object *obj, zval *offset) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
}
/* }}} */
@@ -4306,38 +4271,34 @@ static ZEND_COLD zend_never_inline void zend_bad_property_access(zend_class_entr
}
/* }}} */
-static ZEND_COLD zval *zend_fake_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
+static ZEND_COLD zval *zend_fake_read_property(zend_object *obj, zend_string *member, int type, void **cache_slot, zval *rv) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_property_access(ce);
+ zend_bad_property_access(obj->ce);
return &EG(uninitialized_zval);
}
/* }}} */
-static ZEND_COLD zval *zend_fake_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static ZEND_COLD zval *zend_fake_write_property(zend_object *obj, zend_string *member, zval *value, void **cache_slot) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
return value;
}
/* }}} */
-static ZEND_COLD int zend_fake_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */
+static ZEND_COLD int zend_fake_has_property(zend_object *obj, zend_string *member, int has_set_exists, void **cache_slot) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
return 0;
}
/* }}} */
-static ZEND_COLD void zend_fake_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */
+static ZEND_COLD void zend_fake_unset_property(zend_object *obj, zend_string *member, void **cache_slot) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
}
/* }}} */
-static zval *zend_fake_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static zval *zend_fake_get_property_ptr_ptr(zend_object *obj, zend_string *member, int type, void **cache_slot) /* {{{ */
{
return NULL;
}
@@ -4351,13 +4312,13 @@ static ZEND_COLD zend_function *zend_fake_get_method(zend_object **obj_ptr, zend
}
/* }}} */
-static HashTable *zend_fake_get_properties(zval *object) /* {{{ */
+static HashTable *zend_fake_get_properties(zend_object *obj) /* {{{ */
{
return (HashTable*)&zend_empty_array;
}
/* }}} */
-static HashTable *zend_fake_get_gc(zval *object, zval **table, int *n) /* {{{ */
+static HashTable *zend_fake_get_gc(zend_object *ob, zval **table, int *n) /* {{{ */
{
*table = NULL;
*n = 0;
@@ -4371,74 +4332,74 @@ static ZEND_COLD zend_never_inline void zend_ffi_use_after_free(void) /* {{{ */
}
/* }}} */
-static zend_object *zend_ffi_free_clone_obj(zval *zobject) /* {{{ */
+static zend_object *zend_ffi_free_clone_obj(zend_object *obj) /* {{{ */
{
zend_ffi_use_after_free();
return NULL;
}
/* }}} */
-static ZEND_COLD zval *zend_ffi_free_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
+static ZEND_COLD zval *zend_ffi_free_read_dimension(zend_object *obj, zval *offset, int type, zval *rv) /* {{{ */
{
zend_ffi_use_after_free();
return NULL;
}
/* }}} */
-static ZEND_COLD void zend_ffi_free_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */
+static ZEND_COLD void zend_ffi_free_write_dimension(zend_object *obj, zval *offset, zval *value) /* {{{ */
{
zend_ffi_use_after_free();
}
/* }}} */
-static ZEND_COLD int zend_ffi_free_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */
+static ZEND_COLD int zend_ffi_free_has_dimension(zend_object *obj, zval *offset, int check_empty) /* {{{ */
{
zend_ffi_use_after_free();
return 0;
}
/* }}} */
-static ZEND_COLD void zend_ffi_free_unset_dimension(zval *object, zval *offset) /* {{{ */
+static ZEND_COLD void zend_ffi_free_unset_dimension(zend_object *obj, zval *offset) /* {{{ */
{
zend_ffi_use_after_free();
}
/* }}} */
-static ZEND_COLD zval *zend_ffi_free_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
+static ZEND_COLD zval *zend_ffi_free_read_property(zend_object *obj, zend_string *member, int type, void **cache_slot, zval *rv) /* {{{ */
{
zend_ffi_use_after_free();
return &EG(uninitialized_zval);
}
/* }}} */
-static ZEND_COLD zval *zend_ffi_free_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static ZEND_COLD zval *zend_ffi_free_write_property(zend_object *obj, zend_string *member, zval *value, void **cache_slot) /* {{{ */
{
zend_ffi_use_after_free();
return value;
}
/* }}} */
-static ZEND_COLD int zend_ffi_free_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */
+static ZEND_COLD int zend_ffi_free_has_property(zend_object *obj, zend_string *member, int has_set_exists, void **cache_slot) /* {{{ */
{
zend_ffi_use_after_free();
return 0;
}
/* }}} */
-static ZEND_COLD void zend_ffi_free_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */
+static ZEND_COLD void zend_ffi_free_unset_property(zend_object *obj, zend_string *member, void **cache_slot) /* {{{ */
{
zend_ffi_use_after_free();
}
/* }}} */
-static zval* zend_ffi_free_get(zval *object, zval *rv) /* {{{ */
+static zval* zend_ffi_free_get(zend_object *obj, zval *rv) /* {{{ */
{
zend_ffi_use_after_free();
return NULL;
}
/* }}} */
-static HashTable *zend_ffi_free_get_debug_info(zval *object, int *is_temp) /* {{{ */
+static HashTable *zend_ffi_free_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
zend_ffi_use_after_free();
return NULL;
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
index 26dae62ff2..73462b8313 100644
--- a/ext/gmp/gmp.c
+++ b/ext/gmp/gmp.c
@@ -404,24 +404,24 @@ static inline void gmp_create(zval *target, mpz_ptr *gmpnum_target) /* {{{ */
}
/* }}} */
-static int gmp_cast_object(zval *readobj, zval *writeobj, int type) /* {{{ */
+static int gmp_cast_object(zend_object *readobj, zval *writeobj, int type) /* {{{ */
{
mpz_ptr gmpnum;
switch (type) {
case IS_STRING:
- gmpnum = GET_GMP_FROM_ZVAL(readobj);
+ gmpnum = GET_GMP_OBJECT_FROM_OBJ(readobj)->num;
gmp_strval(writeobj, gmpnum, 10);
return SUCCESS;
case IS_LONG:
- gmpnum = GET_GMP_FROM_ZVAL(readobj);
+ gmpnum = GET_GMP_OBJECT_FROM_OBJ(readobj)->num;
ZVAL_LONG(writeobj, mpz_get_si(gmpnum));
return SUCCESS;
case IS_DOUBLE:
- gmpnum = GET_GMP_FROM_ZVAL(readobj);
+ gmpnum = GET_GMP_OBJECT_FROM_OBJ(readobj)->num;
ZVAL_DOUBLE(writeobj, mpz_get_d(gmpnum));
return SUCCESS;
case _IS_NUMBER:
- gmpnum = GET_GMP_FROM_ZVAL(readobj);
+ gmpnum = GET_GMP_OBJECT_FROM_OBJ(readobj)->num;
if (mpz_fits_slong_p(gmpnum)) {
ZVAL_LONG(writeobj, mpz_get_si(gmpnum));
} else {
@@ -434,10 +434,10 @@ static int gmp_cast_object(zval *readobj, zval *writeobj, int type) /* {{{ */
}
/* }}} */
-static HashTable *gmp_get_debug_info(zval *obj, int *is_temp) /* {{{ */
+static HashTable *gmp_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
HashTable *ht, *props = zend_std_get_properties(obj);
- mpz_ptr gmpnum = GET_GMP_FROM_ZVAL(obj);
+ mpz_ptr gmpnum = GET_GMP_OBJECT_FROM_OBJ(obj)->num;
zval zv;
*is_temp = 1;
@@ -450,10 +450,10 @@ static HashTable *gmp_get_debug_info(zval *obj, int *is_temp) /* {{{ */
}
/* }}} */
-static zend_object *gmp_clone_obj(zval *obj) /* {{{ */
+static zend_object *gmp_clone_obj(zend_object *obj) /* {{{ */
{
- gmp_object *old_object = GET_GMP_OBJECT_FROM_ZVAL(obj);
- gmp_object *new_object = GET_GMP_OBJECT_FROM_OBJ(gmp_create_object(Z_OBJCE_P(obj)));
+ gmp_object *old_object = GET_GMP_OBJECT_FROM_OBJ(obj);
+ gmp_object *new_object = GET_GMP_OBJECT_FROM_OBJ(gmp_create_object(obj->ce));
zend_objects_clone_members( &new_object->std, &old_object->std);
@@ -574,7 +574,7 @@ static int gmp_serialize(zval *object, unsigned char **buffer, size_t *buf_len,
php_var_serialize(&buf, &zv, &serialize_data);
zval_ptr_dtor_str(&zv);
- ZVAL_ARR(&zv, zend_std_get_properties(object));
+ ZVAL_ARR(&zv, zend_std_get_properties(Z_OBJ_P(object)));
php_var_serialize(&buf, &zv, &serialize_data);
PHP_VAR_SERIALIZE_DESTROY(serialize_data);
@@ -593,14 +593,12 @@ static int gmp_unserialize(zval *object, zend_class_entry *ce, const unsigned ch
zval *zv;
int retval = FAILURE;
php_unserialize_data_t unserialize_data;
- zval object_copy;
+ zend_object *zobj;
PHP_VAR_UNSERIALIZE_INIT(unserialize_data);
gmp_create(object, &gmpnum);
- /* The "object" variable may be modified during the execution of this unserialize handler
- * (it may turn into a reference). Keep the original object around for further operations. */
- ZVAL_COPY_VALUE(&object_copy, object);
+ zobj = Z_OBJ_P(object);
p = buf;
max = buf + buf_len;
@@ -624,7 +622,7 @@ static int gmp_unserialize(zval *object, zend_class_entry *ce, const unsigned ch
if (zend_hash_num_elements(Z_ARRVAL_P(zv)) != 0) {
zend_hash_copy(
- zend_std_get_properties(&object_copy), Z_ARRVAL_P(zv),
+ zend_std_get_properties(zobj), Z_ARRVAL_P(zv),
(copy_ctor_func_t) zval_add_ref
);
}
diff --git a/ext/hash/hash.c b/ext/hash/hash.c
index 1c1d0b4ece..1da1ae68e2 100644
--- a/ext/hash/hash.c
+++ b/ext/hash/hash.c
@@ -569,7 +569,7 @@ PHP_FUNCTION(hash_copy)
return;
}
- RETVAL_OBJ(Z_OBJ_HANDLER_P(zhash, clone_obj)(zhash));
+ RETVAL_OBJ(Z_OBJ_HANDLER_P(zhash, clone_obj)(Z_OBJ_P(zhash)));
if (php_hashcontext_from_object(Z_OBJ_P(return_value))->context == NULL) {
zval_ptr_dtor(return_value);
@@ -1137,12 +1137,12 @@ static void php_hashcontext_dtor(zend_object *obj) {
/* }}} */
/* {{{ php_hashcontext_clone */
-static zend_object *php_hashcontext_clone(zval *pzv) {
- php_hashcontext_object *oldobj = php_hashcontext_from_object(Z_OBJ_P(pzv));
- zend_object *znew = php_hashcontext_create(Z_OBJCE_P(pzv));
+static zend_object *php_hashcontext_clone(zend_object *zobj) {
+ php_hashcontext_object *oldobj = php_hashcontext_from_object(zobj);
+ zend_object *znew = php_hashcontext_create(zobj->ce);
php_hashcontext_object *newobj = php_hashcontext_from_object(znew);
- zend_objects_clone_members(znew, Z_OBJ_P(pzv));
+ zend_objects_clone_members(znew, zobj);
newobj->ops = oldobj->ops;
newobj->options = oldobj->options;
diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp
index 0d64efece4..7267ff2e7d 100644
--- a/ext/intl/breakiterator/breakiterator_class.cpp
+++ b/ext/intl/breakiterator/breakiterator_class.cpp
@@ -96,16 +96,16 @@ static int BreakIterator_compare_objects(zval *object1,
/* }}} */
/* {{{ clone handler for BreakIterator */
-static zend_object *BreakIterator_clone_obj(zval *object)
+static zend_object *BreakIterator_clone_obj(zend_object *object)
{
BreakIterator_object *bio_orig,
*bio_new;
zend_object *ret_val;
- bio_orig = Z_INTL_BREAKITERATOR_P(object);
+ bio_orig = php_intl_breakiterator_fetch_object(object);
intl_errors_reset(INTL_DATA_ERROR_P(bio_orig));
- ret_val = BreakIterator_ce_ptr->create_object(Z_OBJCE_P(object));
+ ret_val = BreakIterator_ce_ptr->create_object(object->ce);
bio_new = php_intl_breakiterator_fetch_object(ret_val);
zend_objects_clone_members(&bio_new->zo, &bio_orig->zo);
@@ -136,7 +136,7 @@ static zend_object *BreakIterator_clone_obj(zval *object)
/* }}} */
/* {{{ get_debug_info handler for BreakIterator */
-static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp)
+static HashTable *BreakIterator_get_debug_info(zend_object *object, int *is_temp)
{
zval val;
HashTable *debug_info;
@@ -147,7 +147,7 @@ static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp)
debug_info = zend_new_array(8);
- bio = Z_INTL_BREAKITERATOR_P(object);
+ bio = php_intl_breakiterator_fetch_object(object);
biter = bio->biter;
if (biter == NULL) {
diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp
index 29eb9eef44..f7cb8739e0 100644
--- a/ext/intl/calendar/calendar_class.cpp
+++ b/ext/intl/calendar/calendar_class.cpp
@@ -78,17 +78,17 @@ U_CFUNC void calendar_object_construct(zval *object,
}
/* {{{ clone handler for Calendar */
-static zend_object *Calendar_clone_obj(zval *object)
+static zend_object *Calendar_clone_obj(zend_object *object)
{
Calendar_object *co_orig,
*co_new;
zend_object *ret_val;
intl_error_reset(NULL);
- co_orig = Z_INTL_CALENDAR_P(object);
+ co_orig = php_intl_calendar_fetch_object(object);
intl_error_reset(INTL_DATA_ERROR_P(co_orig));
- ret_val = Calendar_ce_ptr->create_object(Z_OBJCE_P(object));
+ ret_val = Calendar_ce_ptr->create_object(object->ce);
co_new = php_intl_calendar_fetch_object(ret_val);
zend_objects_clone_members(&co_new->zo, &co_orig->zo);
@@ -147,7 +147,7 @@ static const struct {
};
/* {{{ get_debug_info handler for Calendar */
-static HashTable *Calendar_get_debug_info(zval *object, int *is_temp)
+static HashTable *Calendar_get_debug_info(zend_object *object, int *is_temp)
{
zval zv,
zfields;
@@ -159,7 +159,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp)
debug_info = zend_new_array(8);
- co = Z_INTL_CALENDAR_P(object);
+ co = php_intl_calendar_fetch_object(object);
cal = co->ucal;
if (cal == NULL) {
@@ -179,7 +179,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp)
HashTable *debug_info_tz;
timezone_object_construct(&cal->getTimeZone(), &ztz , 0);
- debug_info_tz = Z_OBJ_HANDLER(ztz, get_debug_info)(&ztz, &is_tmp);
+ debug_info_tz = Z_OBJ_HANDLER(ztz, get_debug_info)(Z_OBJ(ztz), &is_tmp);
assert(is_tmp == 1);
array_init(&ztz_debug);
diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp
index dfe34a4f03..2188fb8276 100644
--- a/ext/intl/calendar/calendar_methods.cpp
+++ b/ext/intl/calendar/calendar_methods.cpp
@@ -1133,7 +1133,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time)
if (!(Z_TYPE_P(zv_arg) == IS_OBJECT && instanceof_function(
Z_OBJCE_P(zv_arg), php_date_get_date_ce()))) {
object_init_ex(&zv_tmp, php_date_get_date_ce());
- zend_call_method_with_1_params(&zv_tmp, NULL, &Z_OBJCE(zv_tmp)->constructor, "__construct", NULL, zv_arg);
+ zend_call_method_with_1_params(Z_OBJ(zv_tmp), NULL, &Z_OBJCE(zv_tmp)->constructor, "__construct", NULL, zv_arg);
zv_datetime = &zv_tmp;
if (EG(exception)) {
zend_object_store_ctor_failed(Z_OBJ(zv_tmp));
@@ -1151,7 +1151,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time)
goto error;
}
- zend_call_method_with_0_params(zv_datetime, php_date_get_date_ce(), NULL, "gettimestamp", &zv_timestamp);
+ zend_call_method_with_0_params(Z_OBJ_P(zv_datetime), php_date_get_date_ce(), NULL, "gettimestamp", &zv_timestamp);
if (Z_TYPE(zv_timestamp) != IS_LONG) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_from_date_time: bad DateTime; call to "
@@ -1249,7 +1249,7 @@ U_CFUNC PHP_FUNCTION(intlcal_to_date_time)
/* Finally, instantiate object and call constructor */
object_init_ex(return_value, php_date_get_date_ce());
- zend_call_method_with_2_params(return_value, NULL, &Z_OBJCE_P(return_value)->constructor, "__construct", NULL, &ts_zval, timezone_zval);
+ zend_call_method_with_2_params(Z_OBJ_P(return_value), NULL, &Z_OBJCE_P(return_value)->constructor, "__construct", NULL, &ts_zval, timezone_zval);
if (EG(exception)) {
intl_errors_set(CALENDAR_ERROR_P(co), U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_to_date_time: DateTime constructor has thrown exception",
@@ -1264,7 +1264,7 @@ U_CFUNC PHP_FUNCTION(intlcal_to_date_time)
zval_ptr_dtor(&ts_zval);
/* due to bug #40743, we have to set the time zone again */
- zend_call_method_with_1_params(return_value, NULL, NULL, "settimezone",
+ zend_call_method_with_1_params(Z_OBJ_P(return_value), NULL, NULL, "settimezone",
&retval, timezone_zval);
if (Z_ISUNDEF(retval) || Z_TYPE(retval) == IS_FALSE) {
intl_errors_set(CALENDAR_ERROR_P(co), U_ILLEGAL_ARGUMENT_ERROR,
diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c
index 2f0a80468e..fc9d7da41f 100644
--- a/ext/intl/collator/collator_convert.c
+++ b/ext/intl/collator/collator_convert.c
@@ -228,7 +228,7 @@ zval* collator_convert_object_to_string( zval* obj, zval *rv )
/* Try object's handlers. */
if( Z_OBJ_HT_P(obj)->get )
{
- zstr = Z_OBJ_HT_P(obj)->get( obj, rv );
+ zstr = Z_OBJ_HT_P(obj)->get( Z_OBJ_P(obj), rv );
switch( Z_TYPE_P( zstr ) )
{
@@ -252,7 +252,7 @@ zval* collator_convert_object_to_string( zval* obj, zval *rv )
{
zstr = rv;
- if( Z_OBJ_HT_P(obj)->cast_object( obj, zstr, IS_STRING ) == FAILURE )
+ if( Z_OBJ_HT_P(obj)->cast_object( Z_OBJ_P(obj), zstr, IS_STRING ) == FAILURE )
{
/* cast_object failed => bail out. */
zval_ptr_dtor( zstr );
diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c
index 992a1bade7..09fa699b00 100644
--- a/ext/intl/converter/converter.c
+++ b/ext/intl/converter/converter.c
@@ -1042,9 +1042,9 @@ static zend_object *php_converter_create_object(zend_class_entry *ce) {
return retval;
}
-static zend_object *php_converter_clone_object(zval *object) {
- php_converter_object *objval, *oldobj = Z_INTL_CONVERTER_P(object);
- zend_object *retval = php_converter_object_ctor(Z_OBJCE_P(object), &objval);
+static zend_object *php_converter_clone_object(zend_object *object) {
+ php_converter_object *objval, *oldobj = php_converter_fetch_object(object);
+ zend_object *retval = php_converter_object_ctor(object->ce, &objval);
UErrorCode error = U_ZERO_ERROR;
intl_errors_reset(&oldobj->error);
diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c
index b923f70508..036641cf95 100644
--- a/ext/intl/dateformat/dateformat_class.c
+++ b/ext/intl/dateformat/dateformat_class.c
@@ -77,14 +77,14 @@ zend_object *IntlDateFormatter_object_create(zend_class_entry *ce)
/* }}} */
/* {{{ IntlDateFormatter_object_clone */
-zend_object *IntlDateFormatter_object_clone(zval *object)
+zend_object *IntlDateFormatter_object_clone(zend_object *object)
{
IntlDateFormatter_object *dfo, *new_dfo;
zend_object *new_obj;
- DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK;
+ dfo = php_intl_dateformatter_fetch_object(object);
- new_obj = IntlDateFormatter_ce_ptr->create_object(Z_OBJCE_P(object));
+ new_obj = IntlDateFormatter_ce_ptr->create_object(object->ce);
new_dfo = php_intl_dateformatter_fetch_object(new_obj);
/* clone standard parts */
zend_objects_clone_members(&new_dfo->zo, &dfo->zo);
diff --git a/ext/intl/formatter/formatter_class.c b/ext/intl/formatter/formatter_class.c
index ad39f39392..31ef45a0fd 100644
--- a/ext/intl/formatter/formatter_class.c
+++ b/ext/intl/formatter/formatter_class.c
@@ -61,13 +61,13 @@ zend_object *NumberFormatter_object_create(zend_class_entry *ce)
/* }}} */
/* {{{ NumberFormatter_object_clone */
-zend_object *NumberFormatter_object_clone(zval *object)
+zend_object *NumberFormatter_object_clone(zend_object *object)
{
NumberFormatter_object *nfo, *new_nfo;
zend_object *new_obj;
- FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK;
- new_obj = NumberFormatter_ce_ptr->create_object(Z_OBJCE_P(object));
+ nfo = php_intl_number_format_fetch_object(object);
+ new_obj = NumberFormatter_ce_ptr->create_object(object->ce);
new_nfo = php_intl_number_format_fetch_object(new_obj);
/* clone standard parts */
zend_objects_clone_members(&new_nfo->zo, &nfo->zo);
diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c
index a6d5b593a6..854fb95fc3 100644
--- a/ext/intl/msgformat/msgformat_class.c
+++ b/ext/intl/msgformat/msgformat_class.c
@@ -61,13 +61,13 @@ zend_object *MessageFormatter_object_create(zend_class_entry *ce)
/* }}} */
/* {{{ MessageFormatter_object_clone */
-zend_object *MessageFormatter_object_clone(zval *object)
+zend_object *MessageFormatter_object_clone(zend_object *object)
{
MessageFormatter_object *mfo, *new_mfo;
zend_object *new_obj;
- MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK;
- new_obj = MessageFormatter_ce_ptr->create_object(Z_OBJCE_P(object));
+ mfo = php_intl_messageformatter_fetch_object(object);
+ new_obj = MessageFormatter_ce_ptr->create_object(object->ce);
new_mfo = php_intl_messageformatter_fetch_object(new_obj);
/* clone standard parts */
zend_objects_clone_members(&new_mfo->zo, &mfo->zo);
diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c
index 2feb6edb13..9b9cb9f9a6 100644
--- a/ext/intl/resourcebundle/resourcebundle_class.c
+++ b/ext/intl/resourcebundle/resourcebundle_class.c
@@ -176,7 +176,7 @@ PHP_FUNCTION( resourcebundle_create )
/* }}} */
/* {{{ resourcebundle_array_fetch */
-static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_value, int fallback)
+static void resourcebundle_array_fetch(zend_object *object, zval *offset, zval *return_value, int fallback)
{
int32_t meindex = 0;
char * mekey = NULL;
@@ -185,7 +185,7 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_
ResourceBundle_object *rb;
intl_error_reset( NULL );
- RESOURCEBUNDLE_METHOD_FETCH_OBJECT;
+ rb = php_intl_resourcebundle_fetch_object(object);
if(Z_TYPE_P(offset) == IS_LONG) {
is_numeric = 1;
@@ -230,7 +230,7 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_
/* }}} */
/* {{{ resourcebundle_array_get */
-zval *resourcebundle_array_get(zval *object, zval *offset, int type, zval *rv)
+zval *resourcebundle_array_get(zend_object *object, zval *offset, int type, zval *rv)
{
if(offset == NULL) {
php_error( E_ERROR, "Cannot apply [] to ResourceBundle object" );
@@ -264,15 +264,14 @@ PHP_FUNCTION( resourcebundle_get )
RETURN_FALSE;
}
- resourcebundle_array_fetch(object, offset, return_value, fallback);
+ resourcebundle_array_fetch(Z_OBJ_P(object), offset, return_value, fallback);
}
/* }}} */
/* {{{ resourcebundle_array_count */
-int resourcebundle_array_count(zval *object, zend_long *count)
+int resourcebundle_array_count(zend_object *object, zend_long *count)
{
- ResourceBundle_object *rb;
- RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK;
+ ResourceBundle_object *rb = php_intl_resourcebundle_fetch_object(object);
if (rb->me == NULL) {
intl_errors_set(&rb->error, U_ILLEGAL_ARGUMENT_ERROR,
diff --git a/ext/intl/spoofchecker/spoofchecker_class.c b/ext/intl/spoofchecker/spoofchecker_class.c
index d8bca44dba..52632ed122 100644
--- a/ext/intl/spoofchecker/spoofchecker_class.c
+++ b/ext/intl/spoofchecker/spoofchecker_class.c
@@ -108,15 +108,15 @@ static const zend_function_entry Spoofchecker_class_functions[] = {
};
/* }}} */
-static zend_object *spoofchecker_clone_obj(zval *object) /* {{{ */
+static zend_object *spoofchecker_clone_obj(zend_object *object) /* {{{ */
{
zend_object *new_obj_val;
Spoofchecker_object *sfo, *new_sfo;
- sfo = Z_INTL_SPOOFCHECKER_P(object);
+ sfo = php_intl_spoofchecker_fetch_object(object);
intl_error_reset(SPOOFCHECKER_ERROR_P(sfo));
- new_obj_val = Spoofchecker_ce_ptr->create_object(Z_OBJCE_P(object));
+ new_obj_val = Spoofchecker_ce_ptr->create_object(object->ce);
new_sfo = php_intl_spoofchecker_fetch_object(new_obj_val);
/* clone standard parts */
zend_objects_clone_members(&new_sfo->zo, &sfo->zo);
diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp
index aabb0f3f55..6caf42cacd 100644
--- a/ext/intl/timezone/timezone_class.cpp
+++ b/ext/intl/timezone/timezone_class.cpp
@@ -98,7 +98,7 @@ U_CFUNC zval *timezone_convert_to_datetimezone(const TimeZone *timeZone,
goto error;
}
ZVAL_STR(&arg, u8str);
- zend_call_method_with_1_params(ret, NULL, &Z_OBJCE_P(ret)->constructor, "__construct", NULL, &arg);
+ zend_call_method_with_1_params(Z_OBJ_P(ret), NULL, &Z_OBJCE_P(ret)->constructor, "__construct", NULL, &arg);
if (EG(exception)) {
spprintf(&message, 0,
"%s: DateTimeZone constructor threw exception", func);
@@ -221,17 +221,17 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone,
/* }}} */
/* {{{ clone handler for TimeZone */
-static zend_object *TimeZone_clone_obj(zval *object)
+static zend_object *TimeZone_clone_obj(zend_object *object)
{
TimeZone_object *to_orig,
*to_new;
zend_object *ret_val;
intl_error_reset(NULL);
- to_orig = Z_INTL_TIMEZONE_P(object);
+ to_orig = php_intl_timezone_fetch_object(object);
intl_error_reset(TIMEZONE_ERROR_P(to_orig));
- ret_val = TimeZone_ce_ptr->create_object(Z_OBJCE_P(object));
+ ret_val = TimeZone_ce_ptr->create_object(object->ce);
to_new = php_intl_timezone_fetch_object(ret_val);
zend_objects_clone_members(&to_new->zo, &to_orig->zo);
@@ -285,7 +285,7 @@ static int TimeZone_compare_objects(zval *object1, zval *object2)
/* }}} */
/* {{{ get_debug_info handler for TimeZone */
-static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp)
+static HashTable *TimeZone_get_debug_info(zend_object *object, int *is_temp)
{
zval zv;
TimeZone_object *to;
@@ -299,7 +299,7 @@ static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp)
debug_info = zend_new_array(8);
- to = Z_INTL_TIMEZONE_P(object);
+ to = php_intl_timezone_fetch_object(object);
tz = to->utimezone;
if (tz == NULL) {
diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c
index a662dcee7d..c9e0f83c0b 100644
--- a/ext/intl/transliterator/transliterator_class.c
+++ b/ext/intl/transliterator/transliterator_class.c
@@ -130,16 +130,16 @@ static zend_object *Transliterator_object_create( zend_class_entry *ce )
*/
/* {{{ clone handler for Transliterator */
-static zend_object *Transliterator_clone_obj( zval *object )
+static zend_object *Transliterator_clone_obj( zend_object *object )
{
Transliterator_object *to_orig,
*to_new;
zend_object *ret_val;
intl_error_reset( NULL );
- to_orig = Z_INTL_TRANSLITERATOR_P( object );
+ to_orig = php_intl_transliterator_fetch_object( object );
intl_error_reset( INTL_DATA_ERROR_P( to_orig ) );
- ret_val = Transliterator_ce_ptr->create_object( Z_OBJCE_P( object ) );
+ ret_val = Transliterator_ce_ptr->create_object( object->ce );
to_new = php_intl_transliterator_fetch_object( ret_val );
zend_objects_clone_members( &to_new->zo, &to_orig->zo );
@@ -189,76 +189,52 @@ err:
}
/* }}} */
-#define TRANSLITERATOR_PROPERTY_HANDLER_PROLOG \
- zval tmp_member; \
- if( Z_TYPE_P( member ) != IS_STRING ) \
- { \
- ZVAL_STR(&tmp_member, \
- zval_get_string_func(member)); \
- member = &tmp_member; \
- cache_slot = NULL; \
- }
-
-#define TRANSLITERATOR_PROPERTY_HANDLER_EPILOG \
- if( member == &tmp_member ) \
- { \
- zval_ptr_dtor_str( &tmp_member ); \
- }
-
/* {{{ get_property_ptr_ptr handler */
-static zval *Transliterator_get_property_ptr_ptr( zval *object, zval *member, int type, void **cache_slot )
+static zval *Transliterator_get_property_ptr_ptr( zend_object *object, zend_string *name, int type, void **cache_slot )
{
zval *retval;
- TRANSLITERATOR_PROPERTY_HANDLER_PROLOG;
-
if(zend_binary_strcmp( "id", sizeof( "id" ) - 1,
- Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 )
+ ZSTR_VAL( name ), ZSTR_LEN( name ) ) == 0 )
{
retval = NULL; /* fallback to read_property */
}
else
{
- retval = zend_std_get_property_ptr_ptr( object, member, type, cache_slot );
+ retval = zend_std_get_property_ptr_ptr( object, name, type, cache_slot );
}
- TRANSLITERATOR_PROPERTY_HANDLER_EPILOG;
-
return retval;
}
/* }}} */
/* {{{ read_property handler */
-static zval *Transliterator_read_property( zval *object, zval *member, int type, void **cache_slot, zval *rv )
+static zval *Transliterator_read_property( zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv )
{
zval *retval;
- TRANSLITERATOR_PROPERTY_HANDLER_PROLOG;
-
if( ( type != BP_VAR_R && type != BP_VAR_IS ) &&
( zend_binary_strcmp( "id", sizeof( "id" ) - 1,
- Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) )
+ ZSTR_VAL( name ), ZSTR_LEN( name ) ) == 0 ) )
{
php_error_docref0( NULL, E_WARNING, "The property \"id\" is read-only" );
retval = &EG( uninitialized_zval );
}
else
{
- retval = zend_std_read_property( object, member, type, cache_slot, rv );
+ retval = zend_std_read_property( object, name, type, cache_slot, rv );
}
- TRANSLITERATOR_PROPERTY_HANDLER_EPILOG;
-
return retval;
}
/* }}} */
/* {{{ write_property handler */
-static zval *Transliterator_write_property( zval *object, zval *member, zval *value, void **cache_slot )
+static zval *Transliterator_write_property( zend_object *object, zend_string *name, zval *value,
+ void **cache_slot )
{
zend_class_entry *scope;
- TRANSLITERATOR_PROPERTY_HANDLER_PROLOG;
if (EG(fake_scope)) {
scope = EG(fake_scope);
@@ -267,17 +243,15 @@ static zval *Transliterator_write_property( zval *object, zval *member, zval *va
}
if( ( scope != Transliterator_ce_ptr ) &&
( zend_binary_strcmp( "id", sizeof( "id" ) - 1,
- Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) )
+ ZSTR_VAL( name ), ZSTR_LEN( name ) ) == 0 ) )
{
php_error_docref0( NULL, E_WARNING, "The property \"id\" is read-only" );
}
else
{
- value = zend_std_write_property( object, member, value, cache_slot );
+ value = zend_std_write_property( object, name, value, cache_slot );
}
- TRANSLITERATOR_PROPERTY_HANDLER_EPILOG;
-
return value;
}
/* }}} */
diff --git a/ext/json/json_parser.y b/ext/json/json_parser.y
index aa37c03658..e251d6e0d4 100644
--- a/ext/json/json_parser.y
+++ b/ext/json/json_parser.y
@@ -274,7 +274,6 @@ static int php_json_parser_object_update(php_json_parser *parser, zval *object,
if (Z_TYPE_P(object) == IS_ARRAY) {
zend_symtable_update(Z_ARRVAL_P(object), key, zvalue);
} else {
- zval zkey;
if (ZSTR_LEN(key) > 0 && ZSTR_VAL(key)[0] == '\0') {
parser->scanner.errcode = PHP_JSON_ERROR_INVALID_PROPERTY_NAME;
zend_string_release_ex(key, 0);
@@ -282,8 +281,7 @@ static int php_json_parser_object_update(php_json_parser *parser, zval *object,
zval_ptr_dtor_nogc(object);
return FAILURE;
}
- ZVAL_NEW_STR(&zkey, key);
- zend_std_write_property(object, &zkey, zvalue, NULL);
+ zend_std_write_property(Z_OBJ_P(object), key, zvalue, NULL);
Z_TRY_DELREF_P(zvalue);
}
zend_string_release_ex(key, 0);
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index 02ec94f478..4745ea0499 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -297,22 +297,16 @@ static int mysqli_write_na(mysqli_object *obj, zval *newval)
/* }}} */
/* {{{ mysqli_read_property */
-zval *mysqli_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+zval *mysqli_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
- zval tmp_member;
zval *retval;
mysqli_object *obj;
mysqli_prop_handler *hnd = NULL;
- obj = Z_MYSQLI_P(object);
-
- if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_STR(&tmp_member, zval_get_string_func(member));
- member = &tmp_member;
- }
+ obj = php_mysqli_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd) {
@@ -321,11 +315,7 @@ zval *mysqli_read_property(zval *object, zval *member, int type, void **cache_sl
retval = &EG(uninitialized_zval);
}
} else {
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
}
return retval;
@@ -333,31 +323,21 @@ zval *mysqli_read_property(zval *object, zval *member, int type, void **cache_sl
/* }}} */
/* {{{ mysqli_write_property */
-zval *mysqli_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+zval *mysqli_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- zval tmp_member;
mysqli_object *obj;
mysqli_prop_handler *hnd = NULL;
- if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_STR(&tmp_member, zval_get_string_func(member));
- member = &tmp_member;
- }
-
- obj = Z_MYSQLI_P(object);
+ obj = php_mysqli_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd) {
hnd->write_func(obj, value);
} else {
- value = zend_std_write_property(object, member, value, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ value = zend_std_write_property(object, name, value, cache_slot);
}
return value;
@@ -376,20 +356,20 @@ void mysqli_add_property(HashTable *h, const char *pname, size_t pname_len, mysq
}
/* }}} */
-static int mysqli_object_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */
+static int mysqli_object_has_property(zend_object *object, zend_string *name, int has_set_exists, void **cache_slot) /* {{{ */
{
- mysqli_object *obj = Z_MYSQLI_P(object);
+ mysqli_object *obj = php_mysqli_fetch_object(object);
mysqli_prop_handler *p;
int ret = 0;
- if ((p = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member))) != NULL) {
+ if ((p = zend_hash_find_ptr(obj->prop_handler, name)) != NULL) {
switch (has_set_exists) {
case ZEND_PROPERTY_EXISTS:
ret = 1;
break;
case ZEND_PROPERTY_NOT_EMPTY: {
zval rv;
- zval *value = mysqli_read_property(object, member, BP_VAR_IS, cache_slot, &rv);
+ zval *value = mysqli_read_property(object, name, BP_VAR_IS, cache_slot, &rv);
if (value != &EG(uninitialized_zval)) {
convert_to_boolean(value);
ret = Z_TYPE_P(value) == IS_TRUE ? 1 : 0;
@@ -398,7 +378,7 @@ static int mysqli_object_has_property(zval *object, zval *member, int has_set_ex
}
case ZEND_PROPERTY_ISSET: {
zval rv;
- zval *value = mysqli_read_property(object, member, BP_VAR_IS, cache_slot, &rv);
+ zval *value = mysqli_read_property(object, name, BP_VAR_IS, cache_slot, &rv);
if (value != &EG(uninitialized_zval)) {
ret = Z_TYPE_P(value) != IS_NULL? 1 : 0;
zval_ptr_dtor(value);
@@ -409,27 +389,26 @@ static int mysqli_object_has_property(zval *object, zval *member, int has_set_ex
php_error_docref(NULL, E_WARNING, "Invalid value for has_set_exists");
}
} else {
- ret = zend_std_has_property(object, member, has_set_exists, cache_slot);
+ ret = zend_std_has_property(object, name, has_set_exists, cache_slot);
}
return ret;
} /* }}} */
-HashTable *mysqli_object_get_debug_info(zval *object, int *is_temp)
+HashTable *mysqli_object_get_debug_info(zend_object *object, int *is_temp)
{
- mysqli_object *obj = Z_MYSQLI_P(object);
+ mysqli_object *obj = php_mysqli_fetch_object(object);
HashTable *retval, *props = obj->prop_handler;
mysqli_prop_handler *entry;
retval = zend_new_array(zend_hash_num_elements(props) + 1);
ZEND_HASH_FOREACH_PTR(props, entry) {
- zval rv, member;
+ zval rv;
zval *value;
- ZVAL_STR(&member, entry->name);
- value = mysqli_read_property(object, &member, BP_VAR_IS, 0, &rv);
+ value = mysqli_read_property(object, entry->name, BP_VAR_IS, 0, &rv);
if (value != &EG(uninitialized_zval)) {
- zend_hash_add(retval, Z_STR(member), value);
+ zend_hash_add(retval, entry->name, value);
}
} ZEND_HASH_FOREACH_END();
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index 0e3f63fe3f..5805a05686 100644
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -419,13 +419,13 @@ static zval *pdo_stmt_instantiate(pdo_dbh_t *dbh, zval *object, zend_class_entry
static void pdo_stmt_construct(zend_execute_data *execute_data, pdo_stmt_t *stmt, zval *object, zend_class_entry *dbstmt_ce, zval *ctor_args) /* {{{ */
{
zval query_string;
- zval z_key;
+ zend_string *key;
ZVAL_STRINGL(&query_string, stmt->query_string, stmt->query_stringlen);
- ZVAL_STRINGL(&z_key, "queryString", sizeof("queryString") - 1);
- zend_std_write_property(object, &z_key, &query_string, NULL);
+ key = zend_string_init("queryString", sizeof("queryString") - 1, 0);
+ zend_std_write_property(Z_OBJ_P(object), key, &query_string, NULL);
zval_ptr_dtor(&query_string);
- zval_ptr_dtor(&z_key);
+ zend_string_release_ex(key, 0);
if (dbstmt_ce->constructor) {
zend_fcall_info fci;
@@ -1350,9 +1350,9 @@ static int dbh_compare(zval *object1, zval *object2)
return -1;
}
-static HashTable *dbh_get_gc(zval *object, zval **gc_data, int *gc_count)
+static HashTable *dbh_get_gc(zend_object *object, zval **gc_data, int *gc_count)
{
- pdo_dbh_t *dbh = Z_PDO_DBH_P(object);
+ pdo_dbh_t *dbh = php_pdo_dbh_fetch_inner(object);
*gc_data = &dbh->def_stmt_ctor_args;
*gc_count = 1;
return zend_std_get_properties(object);
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index d18782437a..50820499cf 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -2176,30 +2176,26 @@ const zend_function_entry pdo_dbstmt_functions[] = {
};
/* {{{ overloaded handlers for PDOStatement class */
-static zval *dbstmt_prop_write(zval *object, zval *member, zval *value, void **cache_slot)
+static zval *dbstmt_prop_write(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- pdo_stmt_t *stmt = Z_PDO_STMT_P(object);
-
- convert_to_string(member);
+ pdo_stmt_t *stmt = php_pdo_stmt_fetch_object(object);
- if (strcmp(Z_STRVAL_P(member), "queryString") == 0) {
+ if (strcmp(ZSTR_VAL(name), "queryString") == 0) {
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "property queryString is read only");
return value;
} else {
- return zend_std_write_property(object, member, value, cache_slot);
+ return zend_std_write_property(object, name, value, cache_slot);
}
}
-static void dbstmt_prop_delete(zval *object, zval *member, void **cache_slot)
+static void dbstmt_prop_delete(zend_object *object, zend_string *name, void **cache_slot)
{
- pdo_stmt_t *stmt = Z_PDO_STMT_P(object);
-
- convert_to_string(member);
+ pdo_stmt_t *stmt = php_pdo_stmt_fetch_object(object);
- if (strcmp(Z_STRVAL_P(member), "queryString") == 0) {
+ if (strcmp(ZSTR_VAL(name), "queryString") == 0) {
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "property queryString is read only");
} else {
- zend_std_unset_property(object, member, cache_slot);
+ zend_std_unset_property(object, name, cache_slot);
}
}
@@ -2246,16 +2242,16 @@ static int dbstmt_compare(zval *object1, zval *object2)
return -1;
}
-static zend_object *dbstmt_clone_obj(zval *zobject)
+static zend_object *dbstmt_clone_obj(zend_object *zobject)
{
pdo_stmt_t *stmt;
pdo_stmt_t *old_stmt;
- stmt = zend_object_alloc(sizeof(pdo_stmt_t), Z_OBJCE_P(zobject));
- zend_object_std_init(&stmt->std, Z_OBJCE_P(zobject));
- object_properties_init(&stmt->std, Z_OBJCE_P(zobject));
+ stmt = zend_object_alloc(sizeof(pdo_stmt_t), zobject->ce);
+ zend_object_std_init(&stmt->std, zobject->ce);
+ object_properties_init(&stmt->std, zobject->ce);
- old_stmt = Z_PDO_STMT_P(zobject);
+ old_stmt = php_pdo_stmt_fetch_object(zobject);
zend_objects_clone_members(&stmt->std, &old_stmt->std);
@@ -2454,12 +2450,44 @@ const zend_function_entry pdo_row_functions[] = {
PHP_FE_END
};
-static zval *row_prop_read(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+static zval *row_prop_read(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
+{
+ pdo_row_t *row = (pdo_row_t *)object;
+ pdo_stmt_t *stmt = row->stmt;
+ int colno = -1;
+ zend_long lval;
+
+ ZVAL_NULL(rv);
+ if (stmt) {
+ if (is_numeric_string_ex(ZSTR_VAL(name), ZSTR_LEN(name), &lval, NULL, 0, NULL) == IS_LONG) {
+ if (lval >= 0 && lval < stmt->column_count) {
+ fetch_value(stmt, rv, lval, NULL);
+ }
+ } else {
+ /* TODO: replace this with a hash of available column names to column
+ * numbers */
+ for (colno = 0; colno < stmt->column_count; colno++) {
+ if (ZSTR_LEN(stmt->columns[colno].name) == ZSTR_LEN(name) &&
+ strncmp(ZSTR_VAL(stmt->columns[colno].name), ZSTR_VAL(name), ZSTR_LEN(name)) == 0) {
+ fetch_value(stmt, rv, colno, NULL);
+ return rv;
+ }
+ }
+ if (strcmp(ZSTR_VAL(name), "queryString") == 0) {
+ //zval_ptr_dtor(rv);
+ return zend_std_read_property(&stmt->std, name, type, cache_slot, rv);
+ }
+ }
+ }
+
+ return rv;
+}
+
+static zval *row_dim_read(zend_object *object, zval *member, int type, zval *rv)
{
- pdo_row_t *row = (pdo_row_t *)Z_OBJ_P(object);
+ pdo_row_t *row = (pdo_row_t *)object;
pdo_stmt_t *stmt = row->stmt;
int colno = -1;
- zval zobj;
zend_long lval;
ZVAL_NULL(rv);
@@ -2485,9 +2513,8 @@ static zval *row_prop_read(zval *object, zval *member, int type, void **cache_sl
}
}
if (strcmp(Z_STRVAL_P(member), "queryString") == 0) {
- ZVAL_OBJ(&zobj, &stmt->std);
//zval_ptr_dtor(rv);
- return zend_std_read_property(&zobj, member, type, cache_slot, rv);
+ return zend_std_read_property(&stmt->std, Z_STR_P(member), type, NULL, rv);
}
}
}
@@ -2495,25 +2522,52 @@ static zval *row_prop_read(zval *object, zval *member, int type, void **cache_sl
return rv;
}
-static zval *row_dim_read(zval *object, zval *member, int type, zval *rv)
+static zval *row_prop_write(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- return row_prop_read(object, member, type, NULL, rv);
+ php_error_docref(NULL, E_WARNING, "This PDORow is not from a writable result set");
+ return value;
}
-static zval *row_prop_write(zval *object, zval *member, zval *value, void **cache_slot)
+static void row_dim_write(zend_object *object, zval *member, zval *value)
{
php_error_docref(NULL, E_WARNING, "This PDORow is not from a writable result set");
- return value;
}
-static void row_dim_write(zval *object, zval *member, zval *value)
+static int row_prop_exists(zend_object *object, zend_string *name, int check_empty, void **cache_slot)
{
- php_error_docref(NULL, E_WARNING, "This PDORow is not from a writable result set");
+ pdo_row_t *row = (pdo_row_t *)object;
+ pdo_stmt_t *stmt = row->stmt;
+ int colno = -1;
+ zend_long lval;
+
+ if (stmt) {
+ if (is_numeric_string_ex(ZSTR_VAL(name), ZSTR_LEN(name), &lval, NULL, 0, NULL) == IS_LONG) {
+ return lval >=0 && lval < stmt->column_count;
+ }
+
+ /* TODO: replace this with a hash of available column names to column
+ * numbers */
+ for (colno = 0; colno < stmt->column_count; colno++) {
+ if (ZSTR_LEN(stmt->columns[colno].name) == ZSTR_LEN(name) &&
+ strncmp(ZSTR_VAL(stmt->columns[colno].name), ZSTR_VAL(name), ZSTR_LEN(name)) == 0) {
+ int res;
+ zval val;
+
+ fetch_value(stmt, &val, colno, NULL);
+ res = check_empty ? i_zend_is_true(&val) : Z_TYPE(val) != IS_NULL;
+ zval_ptr_dtor_nogc(&val);
+
+ return res;
+ }
+ }
+ }
+
+ return 0;
}
-static int row_prop_exists(zval *object, zval *member, int check_empty, void **cache_slot)
+static int row_dim_exists(zend_object *object, zval *member, int check_empty)
{
- pdo_row_t *row = (pdo_row_t *)Z_OBJ_P(object);
+ pdo_row_t *row = (pdo_row_t *)object;
pdo_stmt_t *stmt = row->stmt;
int colno = -1;
zend_long lval;
@@ -2549,24 +2603,19 @@ static int row_prop_exists(zval *object, zval *member, int check_empty, void **c
return 0;
}
-static int row_dim_exists(zval *object, zval *member, int check_empty)
-{
- return row_prop_exists(object, member, check_empty, NULL);
-}
-
-static void row_prop_delete(zval *object, zval *offset, void **cache_slot)
+static void row_prop_delete(zend_object *object, zend_string *offset, void **cache_slot)
{
php_error_docref(NULL, E_WARNING, "Cannot delete properties from a PDORow");
}
-static void row_dim_delete(zval *object, zval *offset)
+static void row_dim_delete(zend_object *object, zval *offset)
{
php_error_docref(NULL, E_WARNING, "Cannot delete properties from a PDORow");
}
-static HashTable *row_get_properties_for(zval *object, zend_prop_purpose purpose)
+static HashTable *row_get_properties_for(zend_object *object, zend_prop_purpose purpose)
{
- pdo_row_t *row = (pdo_row_t *)Z_OBJ_P(object);
+ pdo_row_t *row = (pdo_row_t *)object;
pdo_stmt_t *stmt = row->stmt;
HashTable *props;
int i;
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
index ff863d20d7..560576ca52 100644
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -1224,7 +1224,7 @@ PHP_METHOD(Phar, __construct)
ZVAL_STRINGL(&arg1, fname, fname_len);
ZVAL_LONG(&arg2, flags);
- zend_call_method_with_2_params(zobj, Z_OBJCE_P(zobj),
+ zend_call_method_with_2_params(Z_OBJ_P(zobj), Z_OBJCE_P(zobj),
&spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg1, &arg2);
zval_ptr_dtor(&arg1);
@@ -1733,7 +1733,7 @@ PHP_METHOD(Phar, buildFromDirectory)
ZVAL_STRINGL(&arg, dir, dir_len);
ZVAL_LONG(&arg2, SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS);
- zend_call_method_with_2_params(&iter, spl_ce_RecursiveDirectoryIterator,
+ zend_call_method_with_2_params(Z_OBJ(iter), spl_ce_RecursiveDirectoryIterator,
&spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg, &arg2);
zval_ptr_dtor(&arg);
@@ -1749,7 +1749,7 @@ PHP_METHOD(Phar, buildFromDirectory)
RETURN_FALSE;
}
- zend_call_method_with_1_params(&iteriter, spl_ce_RecursiveIteratorIterator,
+ zend_call_method_with_1_params(Z_OBJ(iteriter), spl_ce_RecursiveIteratorIterator,
&spl_ce_RecursiveIteratorIterator->constructor, "__construct", NULL, &iter);
if (EG(exception)) {
@@ -1772,7 +1772,7 @@ PHP_METHOD(Phar, buildFromDirectory)
ZVAL_STRINGL(&arg2, regex, regex_len);
- zend_call_method_with_2_params(&regexiter, spl_ce_RegexIterator,
+ zend_call_method_with_2_params(Z_OBJ(regexiter), spl_ce_RegexIterator,
&spl_ce_RegexIterator->constructor, "__construct", NULL, &iteriter, &arg2);
zval_ptr_dtor(&arg2);
}
@@ -2223,7 +2223,7 @@ its_ok:
ZVAL_STRINGL(&arg1, phar->fname, phar->fname_len);
- zend_call_method_with_1_params(&ret, ce, &ce->constructor, "__construct", NULL, &arg1);
+ zend_call_method_with_1_params(Z_OBJ(ret), ce, &ce->constructor, "__construct", NULL, &arg1);
zval_ptr_dtor(&arg1);
return Z_OBJ(ret);
}
@@ -4480,7 +4480,7 @@ PHP_METHOD(PharFileInfo, __construct)
ZVAL_STRINGL(&arg1, fname, fname_len);
- zend_call_method_with_1_params(zobj, Z_OBJCE_P(zobj),
+ zend_call_method_with_1_params(Z_OBJ_P(zobj), Z_OBJCE_P(zobj),
&spl_ce_SplFileInfo->constructor, "__construct", NULL, &arg1);
zval_ptr_dtor(&arg1);
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index b09953b897..92d9d9138a 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -43,11 +43,8 @@
#include "zend_smart_str.h"
#define reflection_update_property(object, name, value) do { \
- zval member; \
- ZVAL_STR(&member, name); \
- zend_std_write_property(object, &member, value, NULL); \
+ zend_std_write_property(Z_OBJ_P(object), name, value, NULL); \
Z_TRY_DELREF_P(value); \
- zval_ptr_dtor(&member); \
} while (0)
#define reflection_update_property_name(object, value) \
@@ -236,9 +233,9 @@ static void reflection_free_objects_storage(zend_object *object) /* {{{ */
}
/* }}} */
-static HashTable *reflection_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */
+static HashTable *reflection_get_gc(zend_object *obj, zval **gc_data, int *gc_data_count) /* {{{ */
{
- reflection_object *intern = Z_REFLECTION_P(obj);
+ reflection_object *intern = reflection_object_from_obj(obj);
*gc_data = &intern->obj;
*gc_data_count = 1;
return zend_std_get_properties(obj);
@@ -435,7 +432,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char
smart_str_append_printf(str, "%s }\n", indent);
if (obj && Z_TYPE_P(obj) == IS_OBJECT) {
- HashTable *properties = Z_OBJ_HT_P(obj)->get_properties(obj);
+ HashTable *properties = Z_OBJ_HT_P(obj)->get_properties(Z_OBJ_P(obj));
zend_string *prop_name;
smart_str prop_str = {0};
@@ -1843,7 +1840,7 @@ ZEND_METHOD(reflection_function, invoke)
if (!Z_ISUNDEF(intern->obj)) {
Z_OBJ_HT(intern->obj)->get_closure(
- &intern->obj, &fcc.called_scope, &fcc.function_handler, &fcc.object);
+ Z_OBJ(intern->obj), &fcc.called_scope, &fcc.function_handler, &fcc.object);
}
result = zend_call_function(&fci, &fcc);
@@ -1906,7 +1903,7 @@ ZEND_METHOD(reflection_function, invokeArgs)
if (!Z_ISUNDEF(intern->obj)) {
Z_OBJ_HT(intern->obj)->get_closure(
- &intern->obj, &fcc.called_scope, &fcc.function_handler, &fcc.object);
+ Z_OBJ(intern->obj), &fcc.called_scope, &fcc.function_handler, &fcc.object);
}
result = zend_call_function(&fci, &fcc);
@@ -4180,7 +4177,6 @@ ZEND_METHOD(reflection_class, hasProperty)
zend_property_info *property_info;
zend_class_entry *ce;
zend_string *name;
- zval property;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) {
return;
@@ -4194,12 +4190,9 @@ ZEND_METHOD(reflection_class, hasProperty)
RETURN_TRUE;
} else {
if (Z_TYPE(intern->obj) != IS_UNDEF) {
- ZVAL_STR_COPY(&property, name);
- if (Z_OBJ_HANDLER(intern->obj, has_property)(&intern->obj, &property, 2, NULL)) {
- zval_ptr_dtor(&property);
+ if (Z_OBJ_HANDLER(intern->obj, has_property)(Z_OBJ(intern->obj), name, 2, NULL)) {
RETURN_TRUE;
}
- zval_ptr_dtor(&property);
}
RETURN_FALSE;
}
@@ -4229,7 +4222,7 @@ ZEND_METHOD(reflection_class, getProperty)
}
} else if (Z_TYPE(intern->obj) != IS_UNDEF) {
/* Check for dynamic properties */
- if (zend_hash_exists(Z_OBJ_HT(intern->obj)->get_properties(&intern->obj), name)) {
+ if (zend_hash_exists(Z_OBJ_HT(intern->obj)->get_properties(Z_OBJ(intern->obj)), name)) {
zend_property_info property_info_tmp;
property_info_tmp.flags = ZEND_ACC_PUBLIC;
property_info_tmp.name = name;
@@ -4343,7 +4336,7 @@ ZEND_METHOD(reflection_class, getProperties)
} ZEND_HASH_FOREACH_END();
if (Z_TYPE(intern->obj) != IS_UNDEF && (filter & ZEND_ACC_PUBLIC) != 0) {
- HashTable *properties = Z_OBJ_HT(intern->obj)->get_properties(&intern->obj);
+ HashTable *properties = Z_OBJ_HT(intern->obj)->get_properties(Z_OBJ(intern->obj));
zval *prop;
ZEND_HASH_FOREACH_STR_KEY_VAL(properties, key, prop) {
_adddynproperty(prop, key, ce, return_value);
@@ -5248,7 +5241,7 @@ ZEND_METHOD(reflection_property, __construct)
&& property_info->ce != ce)) {
/* Check for dynamic properties */
if (property_info == NULL && Z_TYPE_P(classname) == IS_OBJECT) {
- if (zend_hash_exists(Z_OBJ_HT_P(classname)->get_properties(classname), name)) {
+ if (zend_hash_exists(Z_OBJ_HT_P(classname)->get_properties(Z_OBJ_P(classname)), name)) {
dynam_prop = 1;
}
}
@@ -5514,7 +5507,6 @@ ZEND_METHOD(reflection_property, isInitialized)
}
RETURN_FALSE;
} else {
- zval name_zv;
zend_class_entry *old_scope;
int retval;
@@ -5529,8 +5521,7 @@ ZEND_METHOD(reflection_property, isInitialized)
old_scope = EG(fake_scope);
EG(fake_scope) = intern->ce;
- ZVAL_STR(&name_zv, ref->unmangled_name);
- retval = Z_OBJ_HT_P(object)->has_property(object, &name_zv, ZEND_PROPERTY_EXISTS, NULL);
+ retval = Z_OBJ_HT_P(object)->has_property(Z_OBJ_P(object), ref->unmangled_name, ZEND_PROPERTY_EXISTS, NULL);
EG(fake_scope) = old_scope;
RETVAL_BOOL(retval);
@@ -6644,20 +6635,19 @@ static const zend_function_entry reflection_ext_functions[] = { /* {{{ */
}; /* }}} */
/* {{{ _reflection_write_property */
-static zval *_reflection_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+static zval *_reflection_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- if ((Z_TYPE_P(member) == IS_STRING)
- && zend_hash_exists(&Z_OBJCE_P(object)->properties_info, Z_STR_P(member))
- && ((Z_STRLEN_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name")))
- || (Z_STRLEN_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class")))))
+ if (zend_hash_exists(&object->ce->properties_info, name)
+ && ((ZSTR_LEN(name) == sizeof("name") - 1 && !memcmp(ZSTR_VAL(name), "name", sizeof("name")))
+ || (ZSTR_LEN(name) == sizeof("class") - 1 && !memcmp(ZSTR_VAL(name), "class", sizeof("class")))))
{
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Cannot set read-only property %s::$%s", ZSTR_VAL(Z_OBJCE_P(object)->name), Z_STRVAL_P(member));
+ "Cannot set read-only property %s::$%s", ZSTR_VAL(object->ce->name), ZSTR_VAL(name));
return &EG(uninitialized_zval);
}
else
{
- return zend_std_write_property(object, member, value, cache_slot);
+ return zend_std_write_property(object, name, value, cache_slot);
}
}
/* }}} */
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index b7eaf90de6..cf459311b7 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -50,7 +50,7 @@ PHP_SXE_API zend_class_entry *sxe_get_element_class_entry() /* {{{ */
static php_sxe_object* php_sxe_object_new(zend_class_entry *ce, zend_function *fptr_count);
static xmlNodePtr php_sxe_reset_iterator(php_sxe_object *sxe, int use_data);
static xmlNodePtr php_sxe_iterator_fetch(php_sxe_object *sxe, xmlNodePtr node, int use_data);
-static zval *sxe_get_value(zval *z, zval *rv);
+static zval *sxe_get_value(zend_object *z, zval *rv);
static void php_sxe_iterator_dtor(zend_object_iterator *iter);
static int php_sxe_iterator_valid(zend_object_iterator *iter);
static zval *php_sxe_iterator_current_data(zend_object_iterator *iter);
@@ -228,7 +228,7 @@ next_iter:
/* {{{ sxe_prop_dim_read()
*/
-static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, zend_bool attribs, int type, zval *rv)
+static zval *sxe_prop_dim_read(zend_object *object, zval *member, zend_bool elements, zend_bool attribs, int type, zval *rv)
{
php_sxe_object *sxe;
char *name;
@@ -238,7 +238,7 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z
int nodendx = 0;
int test = 0;
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
if (!member) {
if (sxe->iter.type == SXE_ITER_ATTRLIST) {
@@ -365,15 +365,17 @@ long_dim:
/* {{{ sxe_property_read()
*/
-static zval *sxe_property_read(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+static zval *sxe_property_read(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
- return sxe_prop_dim_read(object, member, 1, 0, type, rv);
+ zval member;
+ ZVAL_STR(&member, name);
+ return sxe_prop_dim_read(object, &member, 1, 0, type, rv);
}
/* }}} */
/* {{{ sxe_dimension_read()
*/
-static zval *sxe_dimension_read(zval *object, zval *offset, int type, zval *rv)
+static zval *sxe_dimension_read(zend_object *object, zval *offset, int type, zval *rv)
{
return sxe_prop_dim_read(object, offset, 0, 1, type, rv);
}
@@ -415,7 +417,7 @@ static void change_node_zval(xmlNodePtr node, zval *value)
/* {{{ sxe_property_write()
*/
-static zval *sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool elements, zend_bool attribs, xmlNodePtr *pnewnode)
+static zval *sxe_prop_dim_write(zend_object *object, zval *member, zval *value, zend_bool elements, zend_bool attribs, xmlNodePtr *pnewnode)
{
php_sxe_object *sxe;
xmlNodePtr node;
@@ -432,7 +434,7 @@ static zval *sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bo
zval tmp_zv, zval_copy;
zend_string *trim_str;
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
if (!member) {
if (sxe->iter.type == SXE_ITER_ATTRLIST) {
@@ -517,7 +519,7 @@ long_dim:
break;
case IS_OBJECT:
if (Z_OBJCE_P(value) == sxe_class_entry) {
- value = sxe_get_value(value, &zval_copy);
+ value = sxe_get_value(Z_OBJ_P(value), &zval_copy);
new_value = 1;
break;
}
@@ -648,40 +650,42 @@ next_iter:
/* {{{ sxe_property_write()
*/
-static zval *sxe_property_write(zval *object, zval *member, zval *value, void **cache_slot)
+static zval *sxe_property_write(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- zval *retval = sxe_prop_dim_write(object, member, value, 1, 0, NULL);
-
+ zval member;
+ ZVAL_STR(&member, name);
+ zval *retval = sxe_prop_dim_write(object, &member, value, 1, 0, NULL);
return retval == &EG(error_zval) ? &EG(uninitialized_zval) : retval;
}
/* }}} */
/* {{{ sxe_dimension_write()
*/
-static void sxe_dimension_write(zval *object, zval *offset, zval *value)
+static void sxe_dimension_write(zend_object *object, zval *offset, zval *value)
{
sxe_prop_dim_write(object, offset, value, 0, 1, NULL);
}
/* }}} */
-static zval *sxe_property_get_adr(zval *object, zval *member, int fetch_type, void **cache_slot) /* {{{ */
+static zval *sxe_property_get_adr(zend_object *object, zend_string *zname, int fetch_type, void **cache_slot) /* {{{ */
{
php_sxe_object *sxe;
xmlNodePtr node;
zval ret;
char *name;
SXE_ITER type;
+ zval member;
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
GET_NODE(sxe, node);
- convert_to_string(member);
- name = Z_STRVAL_P(member);
+ name = ZSTR_VAL(zname);
node = sxe_get_element_by_name(sxe, node, &name, &type);
if (node) {
return NULL;
}
- if (sxe_prop_dim_write(object, member, NULL, 1, 0, &node) == &EG(error_zval)) {
+ ZVAL_STR(&member, zname);
+ if (sxe_prop_dim_write(object, &member, NULL, 1, 0, &node) == &EG(error_zval)) {
return NULL;
}
type = SXE_ITER_NONE;
@@ -701,7 +705,7 @@ static zval *sxe_property_get_adr(zval *object, zval *member, int fetch_type, vo
/* {{{ sxe_prop_dim_exists()
*/
-static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend_bool elements, zend_bool attribs)
+static int sxe_prop_dim_exists(zend_object *object, zval *member, int check_empty, zend_bool elements, zend_bool attribs)
{
php_sxe_object *sxe;
xmlNodePtr node;
@@ -715,7 +719,7 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend
member = &tmp_zv;
}
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
GET_NODE(sxe, node);
@@ -803,15 +807,17 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend
/* {{{ sxe_property_exists()
*/
-static int sxe_property_exists(zval *object, zval *member, int check_empty, void **cache_slot)
+static int sxe_property_exists(zend_object *object, zend_string *name, int check_empty, void **cache_slot)
{
- return sxe_prop_dim_exists(object, member, check_empty, 1, 0);
+ zval member;
+ ZVAL_STR(&member, name);
+ return sxe_prop_dim_exists(object, &member, check_empty, 1, 0);
}
/* }}} */
/* {{{ sxe_dimension_exists()
*/
-static int sxe_dimension_exists(zval *object, zval *member, int check_empty)
+static int sxe_dimension_exists(zend_object *object, zval *member, int check_empty)
{
return sxe_prop_dim_exists(object, member, check_empty, 0, 1);
}
@@ -819,7 +825,7 @@ static int sxe_dimension_exists(zval *object, zval *member, int check_empty)
/* {{{ sxe_prop_dim_delete()
*/
-static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements, zend_bool attribs)
+static void sxe_prop_dim_delete(zend_object *object, zval *member, zend_bool elements, zend_bool attribs)
{
php_sxe_object *sxe;
xmlNodePtr node;
@@ -834,7 +840,7 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements,
member = &tmp_zv;
}
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
GET_NODE(sxe, node);
@@ -926,15 +932,17 @@ next_iter:
/* {{{ sxe_property_delete()
*/
-static void sxe_property_delete(zval *object, zval *member, void **cache_slot)
+static void sxe_property_delete(zend_object *object, zend_string *name, void **cache_slot)
{
- sxe_prop_dim_delete(object, member, 1, 0);
+ zval member;
+ ZVAL_STR(&member, name);
+ sxe_prop_dim_delete(object, &member, 1, 0);
}
/* }}} */
/* {{{ sxe_dimension_unset()
*/
-static void sxe_dimension_delete(zval *object, zval *offset)
+static void sxe_dimension_delete(zend_object *object, zval *offset)
{
sxe_prop_dim_delete(object, offset, 0, 1);
}
@@ -1008,7 +1016,7 @@ static void sxe_properties_add(HashTable *rv, char *name, int namelen, zval *val
}
/* }}} */
-static int sxe_prop_is_empty(zval *object) /* {{{ */
+static int sxe_prop_is_empty(zend_object *object) /* {{{ */
{
php_sxe_object *sxe;
xmlNodePtr node;
@@ -1017,7 +1025,7 @@ static int sxe_prop_is_empty(zval *object) /* {{{ */
int test;
int is_empty;
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
GET_NODE(sxe, node);
if (!node) {
@@ -1099,7 +1107,7 @@ next_iter:
}
/* }}} */
-static HashTable *sxe_get_prop_hash(zval *object, int is_debug) /* {{{ */
+static HashTable *sxe_get_prop_hash(zend_object *object, int is_debug) /* {{{ */
{
zval value;
zval zattr;
@@ -1115,7 +1123,7 @@ static HashTable *sxe_get_prop_hash(zval *object, int is_debug) /* {{{ */
use_iter = 0;
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
if (is_debug) {
rv = zend_new_array(0);
@@ -1229,9 +1237,9 @@ next_iter:
}
/* }}} */
-static HashTable *sxe_get_gc(zval *object, zval **table, int *n) /* {{{ */ {
+static HashTable *sxe_get_gc(zend_object *object, zval **table, int *n) /* {{{ */ {
php_sxe_object *sxe;
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
*table = NULL;
*n = 0;
@@ -1239,13 +1247,13 @@ static HashTable *sxe_get_gc(zval *object, zval **table, int *n) /* {{{ */ {
}
/* }}} */
-static HashTable *sxe_get_properties(zval *object) /* {{{ */
+static HashTable *sxe_get_properties(zend_object *object) /* {{{ */
{
return sxe_get_prop_hash(object, 0);
}
/* }}} */
-static HashTable * sxe_get_debug_info(zval *object, int *is_temp) /* {{{ */
+static HashTable * sxe_get_debug_info(zend_object *object, int *is_temp) /* {{{ */
{
*is_temp = 1;
return sxe_get_prop_hash(object, 1);
@@ -1855,14 +1863,14 @@ static int cast_object(zval *object, int type, char *contents)
/* {{{ sxe_object_cast()
*/
-static int sxe_object_cast_ex(zval *readobj, zval *writeobj, int type)
+static int sxe_object_cast_ex(zend_object *readobj, zval *writeobj, int type)
{
php_sxe_object *sxe;
xmlChar *contents = NULL;
xmlNodePtr node;
int rv;
- sxe = Z_SXEOBJ_P(readobj);
+ sxe = php_sxe_fetch_object(readobj);
if (type == _IS_BOOL) {
node = php_sxe_get_first_node(sxe, NULL);
@@ -1904,7 +1912,7 @@ static int sxe_object_cast_ex(zval *readobj, zval *writeobj, int type)
/* }}} */
/* {{{ Variant of sxe_object_cast_ex that handles overwritten __toString() method */
-static int sxe_object_cast(zval *readobj, zval *writeobj, int type)
+static int sxe_object_cast(zend_object *readobj, zval *writeobj, int type)
{
if (type == IS_STRING
&& zend_std_cast_object_tostring(readobj, writeobj, IS_STRING) == SUCCESS
@@ -1920,7 +1928,7 @@ static int sxe_object_cast(zval *readobj, zval *writeobj, int type)
Returns the string content */
SXE_METHOD(__toString)
{
- if (sxe_object_cast_ex(ZEND_THIS, return_value, IS_STRING) != SUCCESS) {
+ if (sxe_object_cast_ex(Z_OBJ_P(ZEND_THIS), return_value, IS_STRING) != SUCCESS) {
zval_ptr_dtor(return_value);
RETURN_EMPTY_STRING();
}
@@ -1954,10 +1962,10 @@ static int php_sxe_count_elements_helper(php_sxe_object *sxe, zend_long *count)
}
/* }}} */
-static int sxe_count_elements(zval *object, zend_long *count) /* {{{ */
+static int sxe_count_elements(zend_object *object, zend_long *count) /* {{{ */
{
php_sxe_object *intern;
- intern = Z_SXEOBJ_P(object);
+ intern = php_sxe_fetch_object(object);
if (intern->fptr_count) {
zval rv;
zend_call_method_with_0_params(object, intern->zo.ce, &intern->fptr_count, "count", &rv);
@@ -1989,9 +1997,9 @@ SXE_METHOD(count)
}
/* }}} */
-static zval *sxe_get_value(zval *z, zval *rv) /* {{{ */
+static zval *sxe_get_value(zend_object *zobj, zval *rv) /* {{{ */
{
- if (sxe_object_cast_ex(z, rv, IS_STRING) == FAILURE) {
+ if (sxe_object_cast_ex(zobj, rv, IS_STRING) == FAILURE) {
zend_error(E_ERROR, "Unable to cast node to string");
/* FIXME: Should not be fatal */
}
@@ -2005,9 +2013,9 @@ static zend_object_handlers sxe_object_handlers;
/* {{{ sxe_object_clone()
*/
static zend_object *
-sxe_object_clone(zval *object)
+sxe_object_clone(zend_object *object)
{
- php_sxe_object *sxe = Z_SXEOBJ_P(object);
+ php_sxe_object *sxe = php_sxe_fetch_object(object);
php_sxe_object *clone;
xmlNodePtr nodep = NULL;
xmlDocPtr docp = NULL;
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index 1cf4999f33..a68ea14e5c 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -1911,22 +1911,16 @@ void php_snmp_add_property(HashTable *h, const char *name, size_t name_length, p
/* {{{ php_snmp_read_property(zval *object, zval *member, int type[, const zend_literal *key])
Generic object property reader */
-zval *php_snmp_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+zval *php_snmp_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
- zval tmp_member;
zval *retval;
php_snmp_object *obj;
php_snmp_prop_handler *hnd;
int ret;
- obj = Z_SNMP_P(object);
+ obj = php_snmp_fetch_object(object);
- if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_STR(&tmp_member, zval_get_string_func(member));
- member = &tmp_member;
- }
-
- hnd = zend_hash_find_ptr(&php_snmp_properties, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(&php_snmp_properties, name);
if (hnd && hnd->read_func) {
ret = hnd->read_func(obj, rv);
@@ -1936,11 +1930,7 @@ zval *php_snmp_read_property(zval *object, zval *member, int type, void **cache_
retval = &EG(uninitialized_zval);
}
} else {
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor(member);
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
}
return retval;
@@ -1949,20 +1939,14 @@ zval *php_snmp_read_property(zval *object, zval *member, int type, void **cache_
/* {{{ php_snmp_write_property(zval *object, zval *member, zval *value[, const zend_literal *key])
Generic object property writer */
-zval *php_snmp_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+zval *php_snmp_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- zval tmp_member;
php_snmp_object *obj;
php_snmp_prop_handler *hnd;
- if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_STR(&tmp_member, zval_get_string_func(member));
- member = &tmp_member;
- }
-
- obj = Z_SNMP_P(object);
+ obj = php_snmp_fetch_object(object);
- hnd = zend_hash_find_ptr(&php_snmp_properties, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(&php_snmp_properties, name);
if (hnd && hnd->write_func) {
hnd->write_func(obj, value);
@@ -1973,11 +1957,7 @@ zval *php_snmp_write_property(zval *object, zval *member, zval *value, void **ca
}
*/
} else {
- value = zend_std_write_property(object, member, value, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor(member);
+ value = zend_std_write_property(object, name, value, cache_slot);
}
return value;
@@ -1986,19 +1966,19 @@ zval *php_snmp_write_property(zval *object, zval *member, zval *value, void **ca
/* {{{ php_snmp_has_property(zval *object, zval *member, int has_set_exists[, const zend_literal *key])
Generic object property checker */
-static int php_snmp_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot)
+static int php_snmp_has_property(zend_object *object, zend_string *name, int has_set_exists, void **cache_slot)
{
zval rv;
php_snmp_prop_handler *hnd;
int ret = 0;
- if ((hnd = zend_hash_find_ptr(&php_snmp_properties, Z_STR_P(member))) != NULL) {
+ if ((hnd = zend_hash_find_ptr(&php_snmp_properties, name)) != NULL) {
switch (has_set_exists) {
case ZEND_PROPERTY_EXISTS:
ret = 1;
break;
case ZEND_PROPERTY_ISSET: {
- zval *value = php_snmp_read_property(object, member, BP_VAR_IS, cache_slot, &rv);
+ zval *value = php_snmp_read_property(object, name, BP_VAR_IS, cache_slot, &rv);
if (value != &EG(uninitialized_zval)) {
ret = Z_TYPE_P(value) != IS_NULL? 1 : 0;
zval_ptr_dtor(value);
@@ -2006,7 +1986,7 @@ static int php_snmp_has_property(zval *object, zval *member, int has_set_exists,
break;
}
default: {
- zval *value = php_snmp_read_property(object, member, BP_VAR_IS, cache_slot, &rv);
+ zval *value = php_snmp_read_property(object, name, BP_VAR_IS, cache_slot, &rv);
if (value != &EG(uninitialized_zval)) {
convert_to_boolean(value);
ret = Z_TYPE_P(value) == IS_TRUE? 1:0;
@@ -2015,13 +1995,13 @@ static int php_snmp_has_property(zval *object, zval *member, int has_set_exists,
}
}
} else {
- ret = zend_std_has_property(object, member, has_set_exists, cache_slot);
+ ret = zend_std_has_property(object, name, has_set_exists, cache_slot);
}
return ret;
}
/* }}} */
-static HashTable *php_snmp_get_gc(zval *object, zval ***gc_data, int *gc_data_count) /* {{{ */
+static HashTable *php_snmp_get_gc(zend_object *object, zval **gc_data, int *gc_data_count) /* {{{ */
{
*gc_data = NULL;
*gc_data_count = 0;
@@ -2031,7 +2011,7 @@ static HashTable *php_snmp_get_gc(zval *object, zval ***gc_data, int *gc_data_co
/* {{{ php_snmp_get_properties(zval *object)
Returns all object properties. Injects SNMP properties into object on first call */
-static HashTable *php_snmp_get_properties(zval *object)
+static HashTable *php_snmp_get_properties(zend_object *object)
{
php_snmp_object *obj;
php_snmp_prop_handler *hnd;
@@ -2039,7 +2019,7 @@ static HashTable *php_snmp_get_properties(zval *object)
zval rv;
zend_string *key;
- obj = Z_SNMP_P(object);
+ obj = php_snmp_fetch_object(object);
props = zend_std_get_properties(object);
ZEND_HASH_FOREACH_STR_KEY_PTR(&php_snmp_properties, key, hnd) {
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 1198885505..fcab6fbae1 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -165,7 +165,7 @@ static void spl_array_object_free_storage(zend_object *object)
zend_object_iterator *spl_array_get_iterator(zend_class_entry *ce, zval *object, int by_ref);
/* {{{ spl_array_object_new_ex */
-static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zval *orig, int clone_orig)
+static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zend_object *orig, int clone_orig)
{
spl_array_object *intern;
zend_class_entry *parent = class_type;
@@ -179,7 +179,7 @@ static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zval *
intern->ar_flags = 0;
intern->ce_get_iterator = spl_ce_ArrayIterator;
if (orig) {
- spl_array_object *other = Z_SPLARRAY_P(orig);
+ spl_array_object *other = spl_array_from_obj(orig);
intern->ar_flags &= ~ SPL_ARRAY_CLONE_MASK;
intern->ar_flags |= (other->ar_flags & SPL_ARRAY_CLONE_MASK);
@@ -187,16 +187,18 @@ static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zval *
if (clone_orig) {
if (other->ar_flags & SPL_ARRAY_IS_SELF) {
ZVAL_UNDEF(&intern->array);
- } else if (Z_OBJ_HT_P(orig) == &spl_handler_ArrayObject) {
+ } else if (orig->handlers == &spl_handler_ArrayObject) {
ZVAL_ARR(&intern->array,
zend_array_dup(spl_array_get_hash_table(other)));
} else {
- ZEND_ASSERT(Z_OBJ_HT_P(orig) == &spl_handler_ArrayIterator);
- ZVAL_COPY(&intern->array, orig);
+ ZEND_ASSERT(orig->handlers == &spl_handler_ArrayIterator);
+ GC_ADDREF(orig);
+ ZVAL_OBJ(&intern->array, orig);
intern->ar_flags |= SPL_ARRAY_USE_OTHER;
}
} else {
- ZVAL_COPY(&intern->array, orig);
+ GC_ADDREF(orig);
+ ZVAL_OBJ(&intern->array, orig);
intern->ar_flags |= SPL_ARRAY_USE_OTHER;
}
} else {
@@ -274,13 +276,11 @@ static zend_object *spl_array_object_new(zend_class_entry *class_type)
/* }}} */
/* {{{ spl_array_object_clone */
-static zend_object *spl_array_object_clone(zval *zobject)
+static zend_object *spl_array_object_clone(zend_object *old_object)
{
- zend_object *old_object;
zend_object *new_object;
- old_object = Z_OBJ_P(zobject);
- new_object = spl_array_object_new_ex(old_object->ce, zobject, 1);
+ new_object = spl_array_object_new_ex(old_object->ce, old_object, 1);
zend_objects_clone_members(new_object, old_object);
@@ -394,11 +394,11 @@ num_index:
}
} /* }}} */
-static int spl_array_has_dimension(zval *object, zval *offset, int check_empty);
+static int spl_array_has_dimension(zend_object *object, zval *offset, int check_empty);
-static zval *spl_array_read_dimension_ex(int check_inherited, zval *object, zval *offset, int type, zval *rv) /* {{{ */
+static zval *spl_array_read_dimension_ex(int check_inherited, zend_object *object, zval *offset, int type, zval *rv) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
zval *ret;
if (check_inherited &&
@@ -417,7 +417,7 @@ static zval *spl_array_read_dimension_ex(int check_inherited, zval *object, zval
} else {
SEPARATE_ARG_IF_REF(offset);
}
- zend_call_method_with_1_params(object, Z_OBJCE_P(object), &intern->fptr_offset_get, "offsetGet", rv, offset);
+ zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_get, "offsetGet", rv, offset);
zval_ptr_dtor(offset);
if (!Z_ISUNDEF_P(rv)) {
@@ -443,14 +443,14 @@ static zval *spl_array_read_dimension_ex(int check_inherited, zval *object, zval
return ret;
} /* }}} */
-static zval *spl_array_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
+static zval *spl_array_read_dimension(zend_object *object, zval *offset, int type, zval *rv) /* {{{ */
{
return spl_array_read_dimension_ex(1, object, offset, type, rv);
} /* }}} */
-static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval *offset, zval *value) /* {{{ */
+static void spl_array_write_dimension_ex(int check_inherited, zend_object *object, zval *offset, zval *value) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
zend_long index;
HashTable *ht;
@@ -463,7 +463,7 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval
} else {
SEPARATE_ARG_IF_REF(offset);
}
- zend_call_method_with_2_params(object, Z_OBJCE_P(object), &intern->fptr_offset_set, "offsetSet", NULL, offset, value);
+ zend_call_method_with_2_params(object, object->ce, &intern->fptr_offset_set, "offsetSet", NULL, offset, value);
zval_ptr_dtor(offset);
return;
}
@@ -518,20 +518,20 @@ num_index:
}
} /* }}} */
-static void spl_array_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */
+static void spl_array_write_dimension(zend_object *object, zval *offset, zval *value) /* {{{ */
{
spl_array_write_dimension_ex(1, object, offset, value);
} /* }}} */
-static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval *offset) /* {{{ */
+static void spl_array_unset_dimension_ex(int check_inherited, zend_object *object, zval *offset) /* {{{ */
{
zend_long index;
HashTable *ht;
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if (check_inherited && intern->fptr_offset_del) {
SEPARATE_ARG_IF_REF(offset);
- zend_call_method_with_1_params(object, Z_OBJCE_P(object), &intern->fptr_offset_del, "offsetUnset", NULL, offset);
+ zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_del, "offsetUnset", NULL, offset);
zval_ptr_dtor(offset);
return;
}
@@ -603,20 +603,20 @@ num_index:
}
} /* }}} */
-static void spl_array_unset_dimension(zval *object, zval *offset) /* {{{ */
+static void spl_array_unset_dimension(zend_object *object, zval *offset) /* {{{ */
{
spl_array_unset_dimension_ex(1, object, offset);
} /* }}} */
-static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *offset, int check_empty) /* {{{ */
+static int spl_array_has_dimension_ex(int check_inherited, zend_object *object, zval *offset, int check_empty) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
zend_long index;
zval rv, *value = NULL, *tmp;
if (check_inherited && intern->fptr_offset_has) {
SEPARATE_ARG_IF_REF(offset);
- zend_call_method_with_1_params(object, Z_OBJCE_P(object), &intern->fptr_offset_has, "offsetExists", &rv, offset);
+ zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_has, "offsetExists", &rv, offset);
zval_ptr_dtor(offset);
if (zend_is_true(&rv)) {
@@ -694,7 +694,7 @@ num_index:
}
} /* }}} */
-static int spl_array_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */
+static int spl_array_has_dimension(zend_object *object, zval *offset, int check_empty) /* {{{ */
{
return spl_array_has_dimension_ex(1, object, offset, check_empty);
} /* }}} */
@@ -708,7 +708,7 @@ SPL_METHOD(Array, offsetExists)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &index) == FAILURE) {
return;
}
- RETURN_BOOL(spl_array_has_dimension_ex(0, ZEND_THIS, index, 2));
+ RETURN_BOOL(spl_array_has_dimension_ex(0, Z_OBJ_P(ZEND_THIS), index, 2));
} /* }}} */
/* {{{ proto mixed ArrayObject::offsetGet(mixed $index)
@@ -720,7 +720,7 @@ SPL_METHOD(Array, offsetGet)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &index) == FAILURE) {
return;
}
- value = spl_array_read_dimension_ex(0, ZEND_THIS, index, BP_VAR_R, return_value);
+ value = spl_array_read_dimension_ex(0, Z_OBJ_P(ZEND_THIS), index, BP_VAR_R, return_value);
if (value != return_value) {
ZVAL_COPY_DEREF(return_value, value);
}
@@ -735,7 +735,7 @@ SPL_METHOD(Array, offsetSet)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &index, &value) == FAILURE) {
return;
}
- spl_array_write_dimension_ex(0, ZEND_THIS, index, value);
+ spl_array_write_dimension_ex(0, Z_OBJ_P(ZEND_THIS), index, value);
} /* }}} */
void spl_array_iterator_append(zval *object, zval *append_value) /* {{{ */
@@ -747,7 +747,7 @@ void spl_array_iterator_append(zval *object, zval *append_value) /* {{{ */
return;
}
- spl_array_write_dimension(object, NULL, append_value);
+ spl_array_write_dimension(Z_OBJ_P(object), NULL, append_value);
} /* }}} */
/* {{{ proto void ArrayObject::append(mixed $newval)
@@ -772,7 +772,7 @@ SPL_METHOD(Array, offsetUnset)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &index) == FAILURE) {
return;
}
- spl_array_unset_dimension_ex(0, ZEND_THIS, index);
+ spl_array_unset_dimension_ex(0, Z_OBJ_P(ZEND_THIS), index);
} /* }}} */
/* {{{ proto array ArrayObject::getArrayCopy()
@@ -786,9 +786,9 @@ SPL_METHOD(Array, getArrayCopy)
RETURN_ARR(zend_array_dup(spl_array_get_hash_table(intern)));
} /* }}} */
-static HashTable *spl_array_get_properties_for(zval *object, zend_prop_purpose purpose) /* {{{ */
+static HashTable *spl_array_get_properties_for(zend_object *object, zend_prop_purpose purpose) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
HashTable *ht;
zend_bool dup;
@@ -823,12 +823,12 @@ static HashTable *spl_array_get_properties_for(zval *object, zend_prop_purpose p
return ht;
} /* }}} */
-static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp) /* {{{ */
+static HashTable* spl_array_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
zval *storage;
zend_string *zname;
zend_class_entry *base;
- spl_array_object *intern = Z_SPLARRAY_P(obj);
+ spl_array_object *intern = spl_array_from_obj(obj);
if (!intern->std.properties) {
rebuild_object_properties(&intern->std);
@@ -847,7 +847,7 @@ static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp) /* {{{ */
storage = &intern->array;
Z_TRY_ADDREF_P(storage);
- base = Z_OBJ_HT_P(obj) == &spl_handler_ArrayIterator
+ base = obj->handlers == &spl_handler_ArrayIterator
? spl_ce_ArrayIterator : spl_ce_ArrayObject;
zname = spl_gen_private_prop_name(base, "storage", sizeof("storage")-1);
zend_symtable_update(debug_info, zname, storage);
@@ -858,75 +858,85 @@ static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp) /* {{{ */
}
/* }}} */
-static HashTable *spl_array_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */
+static HashTable *spl_array_get_gc(zend_object *obj, zval **gc_data, int *gc_data_count) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(obj);
+ spl_array_object *intern = spl_array_from_obj(obj);
*gc_data = &intern->array;
*gc_data_count = 1;
return zend_std_get_properties(obj);
}
/* }}} */
-static zval *spl_array_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
+static zval *spl_array_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !zend_std_has_property(object, member, ZEND_PROPERTY_EXISTS, NULL)) {
- return spl_array_read_dimension(object, member, type, rv);
+ && !zend_std_has_property(object, name, ZEND_PROPERTY_EXISTS, NULL)) {
+ zval member;
+ ZVAL_STR(&member, name);
+ return spl_array_read_dimension(object, &member, type, rv);
}
- return zend_std_read_property(object, member, type, cache_slot, rv);
+ return zend_std_read_property(object, name, type, cache_slot, rv);
} /* }}} */
-static zval *spl_array_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static zval *spl_array_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !zend_std_has_property(object, member, ZEND_PROPERTY_EXISTS, NULL)) {
- spl_array_write_dimension(object, member, value);
+ && !zend_std_has_property(object, name, ZEND_PROPERTY_EXISTS, NULL)) {
+ zval member;
+ ZVAL_STR(&member, name);
+ spl_array_write_dimension(object, &member, value);
return value;
}
- return zend_std_write_property(object, member, value, cache_slot);
+ return zend_std_write_property(object, name, value, cache_slot);
} /* }}} */
-static zval *spl_array_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static zval *spl_array_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !zend_std_has_property(object, member, ZEND_PROPERTY_EXISTS, NULL)) {
+ && !zend_std_has_property(object, name, ZEND_PROPERTY_EXISTS, NULL)) {
/* If object has offsetGet() overridden, then fallback to read_property,
* which will call offsetGet(). */
+ zval member;
if (intern->fptr_offset_get) {
return NULL;
}
- return spl_array_get_dimension_ptr(1, intern, member, type);
+ ZVAL_STR(&member, name);
+ return spl_array_get_dimension_ptr(1, intern, &member, type);
}
- return zend_std_get_property_ptr_ptr(object, member, type, cache_slot);
+ return zend_std_get_property_ptr_ptr(object, name, type, cache_slot);
} /* }}} */
-static int spl_array_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */
+static int spl_array_has_property(zend_object *object, zend_string *name, int has_set_exists, void **cache_slot) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !zend_std_has_property(object, member, ZEND_PROPERTY_EXISTS, NULL)) {
- return spl_array_has_dimension(object, member, has_set_exists);
+ && !zend_std_has_property(object, name, ZEND_PROPERTY_EXISTS, NULL)) {
+ zval member;
+ ZVAL_STR(&member, name);
+ return spl_array_has_dimension(object, &member, has_set_exists);
}
- return zend_std_has_property(object, member, has_set_exists, cache_slot);
+ return zend_std_has_property(object, name, has_set_exists, cache_slot);
} /* }}} */
-static void spl_array_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */
+static void spl_array_unset_property(zend_object *object, zend_string *name, void **cache_slot) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !zend_std_has_property(object, member, ZEND_PROPERTY_EXISTS, NULL)) {
- spl_array_unset_dimension(object, member);
+ && !zend_std_has_property(object, name, ZEND_PROPERTY_EXISTS, NULL)) {
+ zval member;
+ ZVAL_STR(&member, name);
+ spl_array_unset_dimension(object, &member);
return;
}
- zend_std_unset_property(object, member, cache_slot);
+ zend_std_unset_property(object, name, cache_slot);
} /* }}} */
static int spl_array_compare_objects(zval *o1, zval *o2) /* {{{ */
@@ -1323,7 +1333,7 @@ SPL_METHOD(Array, getIterator)
return;
}
- ZVAL_OBJ(return_value, spl_array_object_new_ex(intern->ce_get_iterator, object, 0));
+ ZVAL_OBJ(return_value, spl_array_object_new_ex(intern->ce_get_iterator, Z_OBJ_P(object), 0));
}
/* }}} */
@@ -1392,9 +1402,9 @@ static zend_long spl_array_object_count_elements_helper(spl_array_object *intern
}
} /* }}} */
-int spl_array_object_count_elements(zval *object, zend_long *count) /* {{{ */
+int spl_array_object_count_elements(zend_object *object, zend_long *count) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if (intern->fptr_count) {
zval rv;
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 5270c264f7..119ba42556 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -337,15 +337,13 @@ static int spl_filesystem_file_open(spl_filesystem_object *intern, int use_inclu
Open the directory
Clone other members (properties)
*/
-static zend_object *spl_filesystem_object_clone(zval *zobject)
+static zend_object *spl_filesystem_object_clone(zend_object *old_object)
{
- zend_object *old_object;
zend_object *new_object;
spl_filesystem_object *intern;
spl_filesystem_object *source;
int index, skip_dots;
- old_object = Z_OBJ_P(zobject);
source = spl_filesystem_from_obj(old_object);
new_object = spl_filesystem_object_new_ex(old_object->ce);
intern = spl_filesystem_from_obj(new_object);
@@ -457,7 +455,7 @@ static spl_filesystem_object *spl_filesystem_object_create_info(spl_filesystem_o
if (ce->constructor->common.scope != spl_ce_SplFileInfo) {
ZVAL_STRINGL(&arg1, file_path, file_path_len);
- zend_call_method_with_1_params(return_value, ce, &ce->constructor, "__construct", NULL, &arg1);
+ zend_call_method_with_1_params(Z_OBJ_P(return_value), ce, &ce->constructor, "__construct", NULL, &arg1);
zval_ptr_dtor(&arg1);
} else {
spl_filesystem_info_set_filename(intern, file_path, file_path_len, use_copy);
@@ -502,7 +500,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int ht, spl_file
spl_filesystem_object_get_file_name(source);
if (ce->constructor->common.scope != spl_ce_SplFileInfo) {
ZVAL_STRINGL(&arg1, source->file_name, source->file_name_len);
- zend_call_method_with_1_params(return_value, ce, &ce->constructor, "__construct", NULL, &arg1);
+ zend_call_method_with_1_params(Z_OBJ_P(return_value), ce, &ce->constructor, "__construct", NULL, &arg1);
zval_ptr_dtor(&arg1);
} else {
intern->file_name = estrndup(source->file_name, source->file_name_len);
@@ -527,7 +525,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int ht, spl_file
if (ce->constructor->common.scope != spl_ce_SplFileObject) {
ZVAL_STRINGL(&arg1, source->file_name, source->file_name_len);
ZVAL_STRINGL(&arg2, "r", 1);
- zend_call_method_with_2_params(return_value, ce, &ce->constructor, "__construct", NULL, &arg1, &arg2);
+ zend_call_method_with_2_params(Z_OBJ_P(return_value), ce, &ce->constructor, "__construct", NULL, &arg1, &arg2);
zval_ptr_dtor(&arg1);
zval_ptr_dtor(&arg2);
} else {
@@ -591,9 +589,9 @@ static char *spl_filesystem_object_get_pathname(spl_filesystem_object *intern, s
}
/* }}} */
-static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_temp) /* {{{ */
+static HashTable *spl_filesystem_object_get_debug_info(zend_object *object, int *is_temp) /* {{{ */
{
- spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(object);
+ spl_filesystem_object *intern = spl_filesystem_from_obj(object);
zval tmp;
HashTable *rv;
zend_string *pnstr;
@@ -840,19 +838,19 @@ SPL_METHOD(DirectoryIterator, seek)
if (intern->u.dir.index > pos) {
/* we first rewind */
- zend_call_method_with_0_params(ZEND_THIS, Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_rewind, "rewind", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_rewind, "rewind", NULL);
}
while (intern->u.dir.index < pos) {
int valid = 0;
- zend_call_method_with_0_params(ZEND_THIS, Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_valid, "valid", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_valid, "valid", &retval);
valid = zend_is_true(&retval);
zval_ptr_dtor(&retval);
if (!valid) {
zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0, "Seek position " ZEND_LONG_FMT " is out of range", pos);
return;
}
- zend_call_method_with_0_params(ZEND_THIS, Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_next, "next", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_next, "next", NULL);
}
} /* }}} */
@@ -1851,12 +1849,12 @@ zend_object_iterator *spl_filesystem_tree_get_iterator(zend_class_entry *ce, zva
/* }}} */
/* {{{ spl_filesystem_object_cast */
-static int spl_filesystem_object_cast(zval *readobj, zval *writeobj, int type)
+static int spl_filesystem_object_cast(zend_object *readobj, zval *writeobj, int type)
{
- spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(readobj);
+ spl_filesystem_object *intern = spl_filesystem_from_obj(readobj);
if (type == IS_STRING) {
- if (Z_OBJCE_P(readobj)->__tostring) {
+ if (readobj->ce->__tostring) {
return zend_std_cast_object_tostring(readobj, writeobj, type);
}
@@ -2153,7 +2151,7 @@ static int spl_filesystem_file_read_line_ex(zval * this_ptr, spl_filesystem_obje
return spl_filesystem_file_read_csv(intern, intern->u.file.delimiter, intern->u.file.enclosure, intern->u.file.escape, NULL);
} else {
zend_execute_data *execute_data = EG(current_execute_data);
- zend_call_method_with_0_params(this_ptr, Z_OBJCE_P(ZEND_THIS), &intern->u.file.func_getCurr, "getCurrentLine", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(this_ptr), Z_OBJCE_P(ZEND_THIS), &intern->u.file.func_getCurr, "getCurrentLine", &retval);
}
if (!Z_ISUNDEF(retval)) {
if (intern->u.file.current_line || !Z_ISUNDEF(intern->u.file.current_zval)) {
diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c
index 2a274595f3..fd59724b5a 100644
--- a/ext/spl/spl_dllist.c
+++ b/ext/spl/spl_dllist.c
@@ -365,7 +365,7 @@ static void spl_dllist_object_free_storage(zend_object *object) /* {{{ */
zend_object_iterator *spl_dllist_get_iterator(zend_class_entry *ce, zval *object, int by_ref);
-static zend_object *spl_dllist_object_new_ex(zend_class_entry *class_type, zval *orig, int clone_orig) /* {{{ */
+static zend_object *spl_dllist_object_new_ex(zend_class_entry *class_type, zend_object *orig, int clone_orig) /* {{{ */
{
spl_dllist_object *intern;
zend_class_entry *parent = class_type;
@@ -380,7 +380,7 @@ static zend_object *spl_dllist_object_new_ex(zend_class_entry *class_type, zval
intern->traverse_position = 0;
if (orig) {
- spl_dllist_object *other = Z_SPLDLLIST_P(orig);
+ spl_dllist_object *other = spl_dllist_from_obj(orig);
intern->ce_get_iterator = other->ce_get_iterator;
if (clone_orig) {
@@ -455,13 +455,9 @@ static zend_object *spl_dllist_object_new(zend_class_entry *class_type) /* {{{ *
}
/* }}} */
-static zend_object *spl_dllist_object_clone(zval *zobject) /* {{{ */
+static zend_object *spl_dllist_object_clone(zend_object *old_object) /* {{{ */
{
- zend_object *old_object;
- zend_object *new_object;
-
- old_object = Z_OBJ_P(zobject);
- new_object = spl_dllist_object_new_ex(old_object->ce, zobject, 1);
+ zend_object *new_object = spl_dllist_object_new_ex(old_object->ce, old_object, 1);
zend_objects_clone_members(new_object, old_object);
@@ -469,9 +465,9 @@ static zend_object *spl_dllist_object_clone(zval *zobject) /* {{{ */
}
/* }}} */
-static int spl_dllist_object_count_elements(zval *object, zend_long *count) /* {{{ */
+static int spl_dllist_object_count_elements(zend_object *object, zend_long *count) /* {{{ */
{
- spl_dllist_object *intern = Z_SPLDLLIST_P(object);
+ spl_dllist_object *intern = spl_dllist_from_obj(object);
if (intern->fptr_count) {
zval rv;
@@ -490,9 +486,9 @@ static int spl_dllist_object_count_elements(zval *object, zend_long *count) /* {
}
/* }}} */
-static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp) /* {{{{ */
+static HashTable* spl_dllist_object_get_debug_info(zend_object *obj, int *is_temp) /* {{{{ */
{
- spl_dllist_object *intern = Z_SPLDLLIST_P(obj);
+ spl_dllist_object *intern = spl_dllist_from_obj(obj);
spl_ptr_llist_element *current = intern->llist->head, *next;
zval tmp, dllist_array;
zend_string *pnstr;
@@ -534,9 +530,9 @@ static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp) /* {
}
/* }}}} */
-static HashTable *spl_dllist_object_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */
+static HashTable *spl_dllist_object_get_gc(zend_object *obj, zval **gc_data, int *gc_data_count) /* {{{ */
{
- spl_dllist_object *intern = Z_SPLDLLIST_P(obj);
+ spl_dllist_object *intern = spl_dllist_from_obj(obj);
spl_ptr_llist_element *current = intern->llist->head;
int i = 0;
@@ -704,7 +700,7 @@ SPL_METHOD(SplDoublyLinkedList, isEmpty)
return;
}
- spl_dllist_object_count_elements(ZEND_THIS, &count);
+ spl_dllist_object_count_elements(Z_OBJ_P(ZEND_THIS), &count);
RETURN_BOOL(count == 0);
}
/* }}} */
diff --git a/ext/spl/spl_engine.h b/ext/spl/spl_engine.h
index c5614a691d..bf14c78b11 100644
--- a/ext/spl/spl_engine.h
+++ b/ext/spl/spl_engine.h
@@ -33,7 +33,7 @@ static inline int spl_instantiate_arg_ex1(zend_class_entry *pce, zval *retval, z
zend_function *func = pce->constructor;
spl_instantiate(pce, retval);
- zend_call_method(retval, pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 1, arg1, NULL);
+ zend_call_method(Z_OBJ_P(retval), pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 1, arg1, NULL);
return 0;
}
/* }}} */
@@ -44,7 +44,7 @@ static inline int spl_instantiate_arg_ex2(zend_class_entry *pce, zval *retval, z
zend_function *func = pce->constructor;
spl_instantiate(pce, retval);
- zend_call_method(retval, pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 2, arg1, arg2);
+ zend_call_method(Z_OBJ_P(retval), pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 2, arg1, arg2);
return 0;
}
/* }}} */
diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c
index 71548abf16..0399c3ce37 100644
--- a/ext/spl/spl_fixedarray.c
+++ b/ext/spl/spl_fixedarray.c
@@ -141,9 +141,9 @@ static void spl_fixedarray_copy(spl_fixedarray *to, spl_fixedarray *from) /* {{{
}
/* }}} */
-static HashTable* spl_fixedarray_object_get_gc(zval *obj, zval **table, int *n) /* {{{{ */
+static HashTable* spl_fixedarray_object_get_gc(zend_object *obj, zval **table, int *n) /* {{{{ */
{
- spl_fixedarray_object *intern = Z_SPLFIXEDARRAY_P(obj);
+ spl_fixedarray_object *intern = spl_fixed_array_from_obj(obj);
HashTable *ht = zend_std_get_properties(obj);
*table = intern->array.elements;
@@ -153,9 +153,9 @@ static HashTable* spl_fixedarray_object_get_gc(zval *obj, zval **table, int *n)
}
/* }}}} */
-static HashTable* spl_fixedarray_object_get_properties(zval *obj) /* {{{{ */
+static HashTable* spl_fixedarray_object_get_properties(zend_object *obj) /* {{{{ */
{
- spl_fixedarray_object *intern = Z_SPLFIXEDARRAY_P(obj);
+ spl_fixedarray_object *intern = spl_fixed_array_from_obj(obj);
HashTable *ht = zend_std_get_properties(obj);
zend_long i = 0;
@@ -202,7 +202,7 @@ static void spl_fixedarray_object_free_storage(zend_object *object) /* {{{ */
zend_object_iterator *spl_fixedarray_get_iterator(zend_class_entry *ce, zval *object, int by_ref);
-static zend_object *spl_fixedarray_object_new_ex(zend_class_entry *class_type, zval *orig, int clone_orig) /* {{{ */
+static zend_object *spl_fixedarray_object_new_ex(zend_class_entry *class_type, zend_object *orig, int clone_orig) /* {{{ */
{
spl_fixedarray_object *intern;
zend_class_entry *parent = class_type;
@@ -218,7 +218,7 @@ static zend_object *spl_fixedarray_object_new_ex(zend_class_entry *class_type, z
intern->flags = 0;
if (orig && clone_orig) {
- spl_fixedarray_object *other = Z_SPLFIXEDARRAY_P(orig);
+ spl_fixedarray_object *other = spl_fixed_array_from_obj(orig);
intern->ce_get_iterator = other->ce_get_iterator;
spl_fixedarray_init(&intern->array, other->array.size);
spl_fixedarray_copy(&intern->array, &other->array);
@@ -296,13 +296,9 @@ static zend_object *spl_fixedarray_new(zend_class_entry *class_type) /* {{{ */
}
/* }}} */
-static zend_object *spl_fixedarray_object_clone(zval *zobject) /* {{{ */
+static zend_object *spl_fixedarray_object_clone(zend_object *old_object) /* {{{ */
{
- zend_object *old_object;
- zend_object *new_object;
-
- old_object = Z_OBJ_P(zobject);
- new_object = spl_fixedarray_object_new_ex(old_object->ce, zobject, 1);
+ zend_object *new_object = spl_fixedarray_object_new_ex(old_object->ce, old_object, 1);
zend_objects_clone_members(new_object, old_object);
@@ -338,11 +334,11 @@ static inline zval *spl_fixedarray_object_read_dimension_helper(spl_fixedarray_o
}
/* }}} */
-static zval *spl_fixedarray_object_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
+static zval *spl_fixedarray_object_read_dimension(zend_object *object, zval *offset, int type, zval *rv) /* {{{ */
{
spl_fixedarray_object *intern;
- intern = Z_SPLFIXEDARRAY_P(object);
+ intern = spl_fixed_array_from_obj(object);
if (type == BP_VAR_IS && intern->fptr_offset_has) {
SEPARATE_ARG_IF_REF(offset);
@@ -407,12 +403,12 @@ static inline void spl_fixedarray_object_write_dimension_helper(spl_fixedarray_o
}
/* }}} */
-static void spl_fixedarray_object_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */
+static void spl_fixedarray_object_write_dimension(zend_object *object, zval *offset, zval *value) /* {{{ */
{
spl_fixedarray_object *intern;
zval tmp;
- intern = Z_SPLFIXEDARRAY_P(object);
+ intern = spl_fixed_array_from_obj(object);
if (intern->fptr_offset_set) {
if (!offset) {
@@ -452,11 +448,11 @@ static inline void spl_fixedarray_object_unset_dimension_helper(spl_fixedarray_o
}
/* }}} */
-static void spl_fixedarray_object_unset_dimension(zval *object, zval *offset) /* {{{ */
+static void spl_fixedarray_object_unset_dimension(zend_object *object, zval *offset) /* {{{ */
{
spl_fixedarray_object *intern;
- intern = Z_SPLFIXEDARRAY_P(object);
+ intern = spl_fixed_array_from_obj(object);
if (intern->fptr_offset_del) {
SEPARATE_ARG_IF_REF(offset);
@@ -501,11 +497,11 @@ static inline int spl_fixedarray_object_has_dimension_helper(spl_fixedarray_obje
}
/* }}} */
-static int spl_fixedarray_object_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */
+static int spl_fixedarray_object_has_dimension(zend_object *object, zval *offset, int check_empty) /* {{{ */
{
spl_fixedarray_object *intern;
- intern = Z_SPLFIXEDARRAY_P(object);
+ intern = spl_fixed_array_from_obj(object);
if (intern->fptr_offset_has) {
zval rv;
@@ -523,11 +519,11 @@ static int spl_fixedarray_object_has_dimension(zval *object, zval *offset, int c
}
/* }}} */
-static int spl_fixedarray_object_count_elements(zval *object, zend_long *count) /* {{{ */
+static int spl_fixedarray_object_count_elements(zend_object *object, zend_long *count) /* {{{ */
{
spl_fixedarray_object *intern;
- intern = Z_SPLFIXEDARRAY_P(object);
+ intern = spl_fixed_array_from_obj(object);
if (intern->fptr_count) {
zval rv;
zend_call_method_with_0_params(object, intern->std.ce, &intern->fptr_count, "count", &rv);
@@ -577,7 +573,7 @@ SPL_METHOD(SplFixedArray, __construct)
SPL_METHOD(SplFixedArray, __wakeup)
{
spl_fixedarray_object *intern = Z_SPLFIXEDARRAY_P(ZEND_THIS);
- HashTable *intern_ht = zend_std_get_properties(ZEND_THIS);
+ HashTable *intern_ht = zend_std_get_properties(Z_OBJ_P(ZEND_THIS));
zval *data;
if (zend_parse_parameters_none() == FAILURE) {
diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c
index aad9ed4f36..ebb63481a7 100644
--- a/ext/spl/spl_heap.c
+++ b/ext/spl/spl_heap.c
@@ -126,7 +126,7 @@ static void spl_ptr_heap_pqueue_elem_ctor(zval *zv) { /* {{{ */
static int spl_ptr_heap_cmp_cb_helper(zval *object, spl_heap_object *heap_object, zval *a, zval *b, zend_long *result) { /* {{{ */
zval zresult;
- zend_call_method_with_2_params(object, heap_object->std.ce, &heap_object->fptr_cmp, "compare", &zresult, a, b);
+ zend_call_method_with_2_params(Z_OBJ_P(object), heap_object->std.ce, &heap_object->fptr_cmp, "compare", &zresult, a, b);
if (EG(exception)) {
return FAILURE;
@@ -378,7 +378,7 @@ static void spl_heap_object_free_storage(zend_object *object) /* {{{ */
}
/* }}} */
-static zend_object *spl_heap_object_new_ex(zend_class_entry *class_type, zval *orig, int clone_orig) /* {{{ */
+static zend_object *spl_heap_object_new_ex(zend_class_entry *class_type, zend_object *orig, int clone_orig) /* {{{ */
{
spl_heap_object *intern;
zend_class_entry *parent = class_type;
@@ -393,7 +393,7 @@ static zend_object *spl_heap_object_new_ex(zend_class_entry *class_type, zval *o
intern->fptr_cmp = NULL;
if (orig) {
- spl_heap_object *other = Z_SPLHEAP_P(orig);
+ spl_heap_object *other = spl_heap_from_obj(orig);
intern->ce_get_iterator = other->ce_get_iterator;
if (clone_orig) {
@@ -462,13 +462,9 @@ static zend_object *spl_heap_object_new(zend_class_entry *class_type) /* {{{ */
}
/* }}} */
-static zend_object *spl_heap_object_clone(zval *zobject) /* {{{ */
+static zend_object *spl_heap_object_clone(zend_object *old_object) /* {{{ */
{
- zend_object *old_object;
- zend_object *new_object;
-
- old_object = Z_OBJ_P(zobject);
- new_object = spl_heap_object_new_ex(old_object->ce, zobject, 1);
+ zend_object *new_object = spl_heap_object_new_ex(old_object->ce, old_object, 1);
zend_objects_clone_members(new_object, old_object);
@@ -476,9 +472,9 @@ static zend_object *spl_heap_object_clone(zval *zobject) /* {{{ */
}
/* }}} */
-static int spl_heap_object_count_elements(zval *object, zend_long *count) /* {{{ */
+static int spl_heap_object_count_elements(zend_object *object, zend_long *count) /* {{{ */
{
- spl_heap_object *intern = Z_SPLHEAP_P(object);
+ spl_heap_object *intern = spl_heap_from_obj(object);
if (intern->fptr_count) {
zval rv;
@@ -498,8 +494,8 @@ static int spl_heap_object_count_elements(zval *object, zend_long *count) /* {{{
}
/* }}} */
-static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zval *obj, int *is_temp) { /* {{{ */
- spl_heap_object *intern = Z_SPLHEAP_P(obj);
+static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zend_object *obj, int *is_temp) { /* {{{ */
+ spl_heap_object *intern = spl_heap_from_obj(obj);
zval tmp, heap_array;
zend_string *pnstr;
HashTable *debug_info;
@@ -545,9 +541,9 @@ static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zv
}
/* }}} */
-static HashTable *spl_heap_object_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */
+static HashTable *spl_heap_object_get_gc(zend_object *obj, zval **gc_data, int *gc_data_count) /* {{{ */
{
- spl_heap_object *intern = Z_SPLHEAP_P(obj);
+ spl_heap_object *intern = spl_heap_from_obj(obj);
*gc_data = intern->heap->elements;
*gc_data_count = intern->heap->count;
@@ -555,13 +551,13 @@ static HashTable *spl_heap_object_get_gc(zval *obj, zval **gc_data, int *gc_data
}
/* }}} */
-static HashTable* spl_heap_object_get_debug_info(zval *obj, int *is_temp) /* {{{ */
+static HashTable* spl_heap_object_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
return spl_heap_object_get_debug_info_helper(spl_ce_SplHeap, obj, is_temp);
}
/* }}} */
-static HashTable* spl_pqueue_object_get_debug_info(zval *obj, int *is_temp) /* {{{ */
+static HashTable* spl_pqueue_object_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
return spl_heap_object_get_debug_info_helper(spl_ce_SplPriorityQueue, obj, is_temp);
}
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 5cddf4d460..dcd9a05f9e 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -201,7 +201,7 @@ static int spl_recursive_it_valid_ex(spl_recursive_it_object *object, zval *zthi
level--;
}
if (object->endIteration && object->in_iteration) {
- zend_call_method_with_0_params(zthis, object->ce, &object->endIteration, "endIteration", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->endIteration, "endIteration", NULL);
}
object->in_iteration = 0;
return FAILURE;
@@ -267,9 +267,9 @@ next_step:
ce = object->iterators[object->level].ce;
zobject = &object->iterators[object->level].zobject;
if (object->callHasChildren) {
- zend_call_method_with_0_params(zthis, object->ce, &object->callHasChildren, "callHasChildren", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->callHasChildren, "callHasChildren", &retval);
} else {
- zend_call_method_with_0_params(zobject, ce, NULL, "haschildren", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, NULL, "haschildren", &retval);
}
if (EG(exception)) {
if (!(object->flags & RIT_CATCH_GET_CHILD)) {
@@ -304,7 +304,7 @@ next_step:
}
}
if (object->nextElement) {
- zend_call_method_with_0_params(zthis, object->ce, &object->nextElement, "nextelement", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->nextElement, "nextelement", NULL);
}
object->iterators[object->level].state = RS_NEXT;
if (EG(exception)) {
@@ -317,7 +317,7 @@ next_step:
return /* self */;
case RS_SELF:
if (object->nextElement && (object->mode == RIT_SELF_FIRST || object->mode == RIT_CHILD_FIRST)) {
- zend_call_method_with_0_params(zthis, object->ce, &object->nextElement, "nextelement", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->nextElement, "nextelement", NULL);
}
if (object->mode == RIT_SELF_FIRST) {
object->iterators[object->level].state = RS_CHILD;
@@ -329,9 +329,9 @@ next_step:
ce = object->iterators[object->level].ce;
zobject = &object->iterators[object->level].zobject;
if (object->callGetChildren) {
- zend_call_method_with_0_params(zthis, object->ce, &object->callGetChildren, "callGetChildren", &child);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->callGetChildren, "callGetChildren", &child);
} else {
- zend_call_method_with_0_params(zobject, ce, NULL, "getchildren", &child);
+ zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, NULL, "getchildren", &child);
}
if (EG(exception)) {
@@ -367,7 +367,7 @@ next_step:
sub_iter->funcs->rewind(sub_iter);
}
if (object->beginChildren) {
- zend_call_method_with_0_params(zthis, object->ce, &object->beginChildren, "beginchildren", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->beginChildren, "beginchildren", NULL);
if (EG(exception)) {
if (!(object->flags & RIT_CATCH_GET_CHILD)) {
return;
@@ -381,7 +381,7 @@ next_step:
/* no more elements */
if (object->level > 0) {
if (object->endChildren) {
- zend_call_method_with_0_params(zthis, object->ce, &object->endChildren, "endchildren", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->endChildren, "endchildren", NULL);
if (EG(exception)) {
if (!(object->flags & RIT_CATCH_GET_CHILD)) {
return;
@@ -415,7 +415,7 @@ static void spl_recursive_it_rewind_ex(spl_recursive_it_object *object, zval *zt
zend_iterator_dtor(sub_iter);
zval_ptr_dtor(&object->iterators[object->level--].zobject);
if (!EG(exception) && (!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(Z_OBJ_P(zthis), object->ce, &object->endChildren, "endchildren", NULL);
}
}
object->iterators = erealloc(object->iterators, sizeof(spl_sub_iterator));
@@ -425,7 +425,7 @@ static void spl_recursive_it_rewind_ex(spl_recursive_it_object *object, zval *zt
sub_iter->funcs->rewind(sub_iter);
}
if (!EG(exception) && object->beginIteration && !object->in_iteration) {
- zend_call_method_with_0_params(zthis, object->ce, &object->beginIteration, "beginIteration", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->beginIteration, "beginIteration", NULL);
}
object->in_iteration = 1;
spl_recursive_it_move_forward_ex(object, zthis);
@@ -494,7 +494,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "o|lzl", &iterator, &flags, &user_caching_it_flags, &mode) == SUCCESS) {
if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate)) {
- zend_call_method_with_0_params(iterator, Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, "getiterator", &aggregate_retval);
+ zend_call_method_with_0_params(Z_OBJ_P(iterator), Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, "getiterator", &aggregate_retval);
iterator = &aggregate_retval;
} else {
Z_ADDREF_P(iterator);
@@ -522,7 +522,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "o|ll", &iterator, &mode, &flags) == SUCCESS) {
if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate)) {
- zend_call_method_with_0_params(iterator, Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, "getiterator", &aggregate_retval);
+ zend_call_method_with_0_params(Z_OBJ_P(iterator), Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, "getiterator", &aggregate_retval);
iterator = &aggregate_retval;
} else {
Z_ADDREF_P(iterator);
@@ -783,7 +783,7 @@ SPL_METHOD(RecursiveIteratorIterator, callHasChildren)
if (Z_TYPE_P(zobject) == IS_UNDEF) {
RETURN_FALSE;
} else {
- zend_call_method_with_0_params(zobject, ce, NULL, "haschildren", return_value);
+ zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, NULL, "haschildren", return_value);
if (Z_TYPE_P(return_value) == IS_UNDEF) {
RETURN_FALSE;
}
@@ -808,7 +808,7 @@ SPL_METHOD(RecursiveIteratorIterator, callGetChildren)
if (Z_TYPE_P(zobject) == IS_UNDEF) {
return;
} else {
- zend_call_method_with_0_params(zobject, ce, NULL, "getchildren", return_value);
+ zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, NULL, "getchildren", return_value);
if (Z_TYPE_P(return_value) == IS_UNDEF) {
RETURN_NULL();
}
@@ -1035,7 +1035,7 @@ static void spl_recursive_tree_iterator_get_prefix(spl_recursive_it_object *obje
smart_str_appendl(&str, ZSTR_VAL(object->prefix[0].s), ZSTR_LEN(object->prefix[0].s));
for (level = 0; level < object->level; ++level) {
- zend_call_method_with_0_params(&object->iterators[level].zobject, object->iterators[level].ce, NULL, "hasnext", &has_next);
+ zend_call_method_with_0_params(Z_OBJ(object->iterators[level].zobject), object->iterators[level].ce, NULL, "hasnext", &has_next);
if (Z_TYPE(has_next) != IS_UNDEF) {
if (Z_TYPE(has_next) == IS_TRUE) {
smart_str_appendl(&str, ZSTR_VAL(object->prefix[1].s), ZSTR_LEN(object->prefix[1].s));
@@ -1045,7 +1045,7 @@ static void spl_recursive_tree_iterator_get_prefix(spl_recursive_it_object *obje
zval_ptr_dtor(&has_next);
}
}
- zend_call_method_with_0_params(&object->iterators[level].zobject, object->iterators[level].ce, NULL, "hasnext", &has_next);
+ zend_call_method_with_0_params(Z_OBJ(object->iterators[level].zobject), object->iterators[level].ce, NULL, "hasnext", &has_next);
if (Z_TYPE(has_next) != IS_UNDEF) {
if (Z_TYPE(has_next) == IS_TRUE) {
smart_str_appendl(&str, ZSTR_VAL(object->prefix[3].s), ZSTR_LEN(object->prefix[3].s));
@@ -1498,7 +1498,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
ce = ce_cast;
}
if (instanceof_function(ce, zend_ce_aggregate)) {
- zend_call_method_with_0_params(zobject, ce, &ce->iterator_funcs_ptr->zf_new_iterator, "getiterator", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, &ce->iterator_funcs_ptr->zf_new_iterator, "getiterator", &retval);
if (EG(exception)) {
zval_ptr_dtor(&retval);
return NULL;
@@ -1517,7 +1517,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
case DIT_AppendIterator:
zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling);
spl_instantiate(spl_ce_ArrayIterator, &intern->u.append.zarrayit);
- zend_call_method_with_0_params(&intern->u.append.zarrayit, spl_ce_ArrayIterator, &spl_ce_ArrayIterator->constructor, "__construct", NULL);
+ zend_call_method_with_0_params(Z_OBJ(intern->u.append.zarrayit), spl_ce_ArrayIterator, &spl_ce_ArrayIterator->constructor, "__construct", NULL);
intern->u.append.iterator = spl_ce_ArrayIterator->get_iterator(spl_ce_ArrayIterator, &intern->u.append.zarrayit, 0);
zend_restore_error_handling(&error_handling);
return intern;
@@ -1815,7 +1815,7 @@ static inline void spl_filter_it_fetch(zval *zthis, spl_dual_it_object *intern)
zval retval;
while (spl_dual_it_fetch(intern, 1) == SUCCESS) {
- zend_call_method_with_0_params(zthis, intern->std.ce, NULL, "accept", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), intern->std.ce, NULL, "accept", &retval);
if (Z_TYPE(retval) != IS_UNDEF) {
if (zend_is_true(&retval)) {
zval_ptr_dtor(&retval);
@@ -1899,7 +1899,7 @@ SPL_METHOD(RecursiveFilterIterator, hasChildren)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "haschildren", &retval);
+ zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "haschildren", &retval);
if (Z_TYPE(retval) != IS_UNDEF) {
RETURN_ZVAL(&retval, 0, 1);
} else {
@@ -1920,7 +1920,7 @@ SPL_METHOD(RecursiveFilterIterator, getChildren)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval);
+ zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "getchildren", &retval);
if (!EG(exception) && Z_TYPE(retval) != IS_UNDEF) {
spl_instantiate_arg_ex1(Z_OBJCE_P(ZEND_THIS), return_value, &retval);
}
@@ -1940,7 +1940,7 @@ SPL_METHOD(RecursiveCallbackFilterIterator, getChildren)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval);
+ zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "getchildren", &retval);
if (!EG(exception) && Z_TYPE(retval) != IS_UNDEF) {
spl_instantiate_arg_ex2(Z_OBJCE_P(ZEND_THIS), return_value, &retval, &intern->u.cbfilter->fci.function_name);
}
@@ -2228,7 +2228,7 @@ SPL_METHOD(RecursiveRegexIterator, getChildren)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval);
+ zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "getchildren", &retval);
if (!EG(exception)) {
zval args[5];
@@ -2262,7 +2262,7 @@ SPL_METHOD(RecursiveRegexIterator, accept)
RETURN_BOOL(zend_hash_num_elements(Z_ARRVAL(intern->current.data)) > 0);
}
- zend_call_method_with_0_params(ZEND_THIS, spl_ce_RegexIterator, NULL, "accept", return_value);
+ zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), spl_ce_RegexIterator, NULL, "accept", return_value);
}
#endif
@@ -2480,7 +2480,7 @@ static inline void spl_limit_it_seek(spl_dual_it_object *intern, zend_long pos)
if (pos != intern->current.pos && instanceof_function(intern->inner.ce, spl_ce_SeekableIterator)) {
ZVAL_LONG(&zpos, pos);
spl_dual_it_free(intern);
- zend_call_method_with_1_params(&intern->inner.zobject, intern->inner.ce, NULL, "seek", NULL, &zpos);
+ zend_call_method_with_1_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "seek", NULL, &zpos);
if (!EG(exception)) {
intern->current.pos = pos;
if (spl_limit_it_valid(intern) == SUCCESS) {
@@ -2630,7 +2630,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern)
/* Recursion ? */
if (intern->dit_type == DIT_RecursiveCachingIterator) {
zval retval, zchildren, zflags;
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "haschildren", &retval);
+ zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "haschildren", &retval);
if (EG(exception)) {
zval_ptr_dtor(&retval);
if (intern->u.caching.flags & CIT_CATCH_GET_CHILD) {
@@ -2640,7 +2640,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern)
}
} else {
if (zend_is_true(&retval)) {
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &zchildren);
+ zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "getchildren", &zchildren);
if (EG(exception)) {
zval_ptr_dtor(&zchildren);
if (intern->u.caching.flags & CIT_CATCH_GET_CHILD) {
diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c
index 8b170afaee..a072b3b537 100644
--- a/ext/spl/spl_observer.c
+++ b/ext/spl/spl_observer.c
@@ -115,7 +115,7 @@ void spl_SplObjectStorage_free_storage(zend_object *object) /* {{{ */
} /* }}} */
-static int spl_object_storage_get_hash(zend_hash_key *key, spl_SplObjectStorage *intern, zval *this, zval *obj) {
+static int spl_object_storage_get_hash(zend_hash_key *key, spl_SplObjectStorage *intern, zend_object *this, zval *obj) {
if (intern->fptr_get_hash) {
zval rv;
zend_call_method_with_1_params(this, intern->std.ce, &intern->fptr_get_hash, "getHash", &rv, obj);
@@ -162,7 +162,7 @@ static spl_SplObjectStorageElement* spl_object_storage_get(spl_SplObjectStorage
}
} /* }}} */
-spl_SplObjectStorageElement *spl_object_storage_attach(spl_SplObjectStorage *intern, zval *this, zval *obj, zval *inf) /* {{{ */
+spl_SplObjectStorageElement *spl_object_storage_attach(spl_SplObjectStorage *intern, zend_object *this, zval *obj, zval *inf) /* {{{ */
{
spl_SplObjectStorageElement *pelement, element;
zend_hash_key key;
@@ -202,7 +202,7 @@ static int spl_object_storage_detach(spl_SplObjectStorage *intern, zval *this, z
{
int ret = FAILURE;
zend_hash_key key;
- if (spl_object_storage_get_hash(&key, intern, this, obj) == FAILURE) {
+ if (spl_object_storage_get_hash(&key, intern, Z_OBJ_P(this), obj) == FAILURE) {
return ret;
}
if (key.key) {
@@ -215,7 +215,7 @@ static int spl_object_storage_detach(spl_SplObjectStorage *intern, zval *this, z
return ret;
} /* }}}*/
-void spl_object_storage_addall(spl_SplObjectStorage *intern, zval *this, spl_SplObjectStorage *other) { /* {{{ */
+void spl_object_storage_addall(spl_SplObjectStorage *intern, zend_object *this, spl_SplObjectStorage *other) { /* {{{ */
spl_SplObjectStorageElement *element;
ZEND_HASH_FOREACH_PTR(&other->storage, element) {
@@ -225,7 +225,7 @@ void spl_object_storage_addall(spl_SplObjectStorage *intern, zval *this, spl_Spl
intern->index = 0;
} /* }}} */
-static zend_object *spl_object_storage_new_ex(zend_class_entry *class_type, zval *orig) /* {{{ */
+static zend_object *spl_object_storage_new_ex(zend_class_entry *class_type, zend_object *orig) /* {{{ */
{
spl_SplObjectStorage *intern;
zend_class_entry *parent = class_type;
@@ -256,7 +256,7 @@ static zend_object *spl_object_storage_new_ex(zend_class_entry *class_type, zval
}
if (orig) {
- spl_SplObjectStorage *other = Z_SPLOBJSTORAGE_P(orig);
+ spl_SplObjectStorage *other = spl_object_storage_from_obj(orig);
spl_object_storage_addall(intern, orig, other);
}
@@ -265,13 +265,11 @@ static zend_object *spl_object_storage_new_ex(zend_class_entry *class_type, zval
/* }}} */
/* {{{ spl_object_storage_clone */
-static zend_object *spl_object_storage_clone(zval *zobject)
+static zend_object *spl_object_storage_clone(zend_object *old_object)
{
- zend_object *old_object;
zend_object *new_object;
- old_object = Z_OBJ_P(zobject);
- new_object = spl_object_storage_new_ex(old_object->ce, zobject);
+ new_object = spl_object_storage_new_ex(old_object->ce, old_object);
zend_objects_clone_members(new_object, old_object);
@@ -279,9 +277,9 @@ static zend_object *spl_object_storage_clone(zval *zobject)
}
/* }}} */
-static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp) /* {{{ */
+static HashTable* spl_object_storage_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
- spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(obj);
+ spl_SplObjectStorage *intern = spl_object_storage_from_obj(obj);
spl_SplObjectStorageElement *element;
HashTable *props;
zval tmp, storage;
@@ -291,7 +289,7 @@ static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp) /* {{{
*is_temp = 1;
- props = Z_OBJPROP_P(obj);
+ props = obj->handlers->get_properties(obj);
debug_info = zend_new_array(zend_hash_num_elements(props) + 1);
zend_hash_copy(debug_info, props, (copy_ctor_func_t)zval_add_ref);
@@ -319,10 +317,10 @@ static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp) /* {{{
/* }}} */
/* overridden for garbage collection */
-static HashTable *spl_object_storage_get_gc(zval *obj, zval **table, int *n) /* {{{ */
+static HashTable *spl_object_storage_get_gc(zend_object *obj, zval **table, int *n) /* {{{ */
{
int i = 0;
- spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(obj);
+ spl_SplObjectStorage *intern = spl_object_storage_from_obj(obj);
spl_SplObjectStorageElement *element;
if (intern->storage.nNumOfElements * 2 > intern->gcdata_num) {
@@ -380,7 +378,7 @@ int spl_object_storage_contains(spl_SplObjectStorage *intern, zval *this, zval *
{
int found;
zend_hash_key key;
- if (spl_object_storage_get_hash(&key, intern, this, obj) == FAILURE) {
+ if (spl_object_storage_get_hash(&key, intern, Z_OBJ_P(this), obj) == FAILURE) {
return 0;
}
@@ -404,7 +402,7 @@ SPL_METHOD(SplObjectStorage, attach)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|z!", &obj, &inf) == FAILURE) {
return;
}
- spl_object_storage_attach(intern, ZEND_THIS, obj, inf);
+ spl_object_storage_attach(intern, Z_OBJ_P(ZEND_THIS), obj, inf);
} /* }}} */
/* {{{ proto void SplObjectStorage::detach(object obj)
@@ -450,7 +448,7 @@ SPL_METHOD(SplObjectStorage, offsetGet)
return;
}
- if (spl_object_storage_get_hash(&key, intern, ZEND_THIS, obj) == FAILURE) {
+ if (spl_object_storage_get_hash(&key, intern, Z_OBJ_P(ZEND_THIS), obj) == FAILURE) {
return;
}
@@ -480,7 +478,7 @@ SPL_METHOD(SplObjectStorage, addAll)
other = Z_SPLOBJSTORAGE_P(obj);
- spl_object_storage_addall(intern, ZEND_THIS, other);
+ spl_object_storage_addall(intern, Z_OBJ_P(ZEND_THIS), other);
RETURN_LONG(zend_hash_num_elements(&intern->storage));
} /* }}} */
@@ -729,7 +727,7 @@ SPL_METHOD(SplObjectStorage, serialize)
/* members */
smart_str_appendl(&buf, "m:", 2);
- ZVAL_ARR(&members, zend_array_dup(zend_std_get_properties(ZEND_THIS)));
+ ZVAL_ARR(&members, zend_array_dup(zend_std_get_properties(Z_OBJ_P(ZEND_THIS))));
php_var_serialize(&buf, &members, &var_hash); /* finishes the string */
zval_ptr_dtor(&members);
@@ -815,7 +813,7 @@ SPL_METHOD(SplObjectStorage, unserialize)
goto outexcept;
}
- if (spl_object_storage_get_hash(&key, intern, ZEND_THIS, &entry) == FAILURE) {
+ if (spl_object_storage_get_hash(&key, intern, Z_OBJ_P(ZEND_THIS), &entry) == FAILURE) {
zval_ptr_dtor(&entry);
zval_ptr_dtor(&inf);
goto outexcept;
@@ -830,7 +828,7 @@ SPL_METHOD(SplObjectStorage, unserialize)
var_push_dtor(&var_hash, &pelement->obj);
}
}
- element = spl_object_storage_attach(intern, ZEND_THIS, &entry, Z_ISUNDEF(inf)?NULL:&inf);
+ element = spl_object_storage_attach(intern, Z_OBJ_P(ZEND_THIS), &entry, Z_ISUNDEF(inf)?NULL:&inf);
var_replace(&var_hash, &entry, &element->obj);
var_replace(&var_hash, &inf, &element->inf);
zval_ptr_dtor(&entry);
@@ -1008,7 +1006,7 @@ SPL_METHOD(MultipleIterator, attachIterator)
}
}
- spl_object_storage_attach(intern, ZEND_THIS, iterator, info);
+ spl_object_storage_attach(intern, Z_OBJ_P(ZEND_THIS), iterator, info);
}
/* }}} */
@@ -1029,7 +1027,7 @@ SPL_METHOD(MultipleIterator, rewind)
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL && !EG(exception)) {
it = &element->obj;
- zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_rewind, "rewind", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_rewind, "rewind", NULL);
zend_hash_move_forward_ex(&intern->storage, &intern->pos);
}
}
@@ -1052,7 +1050,7 @@ SPL_METHOD(MultipleIterator, next)
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL && !EG(exception)) {
it = &element->obj;
- zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_next, "next", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_next, "next", NULL);
zend_hash_move_forward_ex(&intern->storage, &intern->pos);
}
}
@@ -1082,7 +1080,7 @@ SPL_METHOD(MultipleIterator, valid)
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL && !EG(exception)) {
it = &element->obj;
- zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_valid, "valid", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_valid, "valid", &retval);
if (!Z_ISUNDEF(retval)) {
valid = (Z_TYPE(retval) == IS_TRUE);
@@ -1118,7 +1116,7 @@ static void spl_multiple_iterator_get_all(spl_SplObjectStorage *intern, int get_
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL && !EG(exception)) {
it = &element->obj;
- zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_valid, "valid", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_valid, "valid", &retval);
if (!Z_ISUNDEF(retval)) {
valid = Z_TYPE(retval) == IS_TRUE;
@@ -1129,9 +1127,9 @@ static void spl_multiple_iterator_get_all(spl_SplObjectStorage *intern, int get_
if (valid) {
if (SPL_MULTIPLE_ITERATOR_GET_ALL_CURRENT == get_type) {
- zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_current, "current", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_current, "current", &retval);
} else {
- zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_key, "key", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_key, "key", &retval);
}
if (Z_ISUNDEF(retval)) {
zend_throw_exception(spl_ce_RuntimeException, "Failed to call sub iterator method", 0);
diff --git a/ext/standard/array.c b/ext/standard/array.c
index b77f711c46..e8b0c64f3c 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -799,13 +799,13 @@ PHP_FUNCTION(count)
/* first, we check if the handler is defined */
if (Z_OBJ_HT_P(array)->count_elements) {
RETVAL_LONG(1);
- if (SUCCESS == Z_OBJ_HT(*array)->count_elements(array, &Z_LVAL_P(return_value))) {
+ if (SUCCESS == Z_OBJ_HT(*array)->count_elements(Z_OBJ_P(array), &Z_LVAL_P(return_value))) {
return;
}
}
/* if not and the object implements Countable we call its count() method */
if (instanceof_function(Z_OBJCE_P(array), zend_ce_countable)) {
- zend_call_method_with_0_params(array, NULL, NULL, "count", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(array), NULL, NULL, "count", &retval);
if (Z_TYPE(retval) != IS_UNDEF) {
RETVAL_LONG(zval_get_long(&retval));
zval_ptr_dtor(&retval);
@@ -4150,9 +4150,12 @@ static inline zval *array_column_fetch_prop(zval *data, zval *name, zval *rv) /*
/* The has_property check is first performed in "exists" mode (which returns true for
* properties that are null but exist) and then in "has" mode to handle objects that
* implement __isset (which is not called in "exists" mode). */
- if (Z_OBJ_HANDLER_P(data, has_property)(data, name, ZEND_PROPERTY_EXISTS, NULL)
- || Z_OBJ_HANDLER_P(data, has_property)(data, name, ZEND_PROPERTY_ISSET, NULL)) {
- prop = Z_OBJ_HANDLER_P(data, read_property)(data, name, BP_VAR_R, NULL, rv);
+ zend_string *str, *tmp_str;
+
+ str = zval_get_tmp_string(name, &tmp_str);
+ if (Z_OBJ_HANDLER_P(data, has_property)(Z_OBJ_P(data), str, ZEND_PROPERTY_EXISTS, NULL)
+ || Z_OBJ_HANDLER_P(data, has_property)(Z_OBJ_P(data), str, ZEND_PROPERTY_ISSET, NULL)) {
+ prop = Z_OBJ_HANDLER_P(data, read_property)(Z_OBJ_P(data), str, BP_VAR_R, NULL, rv);
if (prop) {
ZVAL_DEREF(prop);
if (prop != rv) {
@@ -4160,6 +4163,7 @@ static inline zval *array_column_fetch_prop(zval *data, zval *name, zval *rv) /*
}
}
}
+ zend_tmp_string_release(tmp_str);
} else if (Z_TYPE_P(data) == IS_ARRAY) {
if (Z_TYPE_P(name) == IS_STRING) {
prop = zend_symtable_find(Z_ARRVAL_P(data), Z_STR_P(name));
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 70fb6abdeb..df4c50545b 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -691,7 +691,7 @@ PHP_FUNCTION(file_put_contents)
if (Z_OBJ_HT_P(data) != NULL) {
zval out;
- if (zend_std_cast_object_tostring(data, &out, IS_STRING) == SUCCESS) {
+ if (zend_std_cast_object_tostring(Z_OBJ_P(data), &out, IS_STRING) == SUCCESS) {
numbytes = php_stream_write(stream, Z_STRVAL(out), Z_STRLEN(out));
if (numbytes != Z_STRLEN(out)) {
php_error_docref(NULL, E_WARNING, "Only "ZEND_LONG_FMT" of %zd bytes written, possibly out of free disk space", numbytes, Z_STRLEN(out));
diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c
index f38fae5f53..0df21e37d7 100644
--- a/ext/standard/incomplete_class.c
+++ b/ext/standard/incomplete_class.c
@@ -32,7 +32,7 @@ static zend_object_handlers php_incomplete_object_handlers;
/* {{{ incomplete_class_message
*/
-static void incomplete_class_message(zval *object, int error_type)
+static void incomplete_class_message(zend_object *object, int error_type)
{
zend_string *class_name;
@@ -47,7 +47,7 @@ static void incomplete_class_message(zval *object, int error_type)
}
/* }}} */
-static zval *incomplete_class_get_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
+static zval *incomplete_class_get_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv) /* {{{ */
{
incomplete_class_message(object, E_NOTICE);
@@ -60,27 +60,27 @@ static zval *incomplete_class_get_property(zval *object, zval *member, int type,
}
/* }}} */
-static zval *incomplete_class_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static zval *incomplete_class_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) /* {{{ */
{
incomplete_class_message(object, E_NOTICE);
return value;
}
/* }}} */
-static zval *incomplete_class_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static zval *incomplete_class_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot) /* {{{ */
{
incomplete_class_message(object, E_NOTICE);
return &EG(error_zval);
}
/* }}} */
-static void incomplete_class_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */
+static void incomplete_class_unset_property(zend_object *object, zend_string *member, void **cache_slot) /* {{{ */
{
incomplete_class_message(object, E_NOTICE);
}
/* }}} */
-static int incomplete_class_has_property(zval *object, zval *member, int check_empty, void **cache_slot) /* {{{ */
+static int incomplete_class_has_property(zend_object *object, zend_string *member, int check_empty, void **cache_slot) /* {{{ */
{
incomplete_class_message(object, E_NOTICE);
return 0;
@@ -89,10 +89,7 @@ static int incomplete_class_has_property(zval *object, zval *member, int check_e
static zend_function *incomplete_class_get_method(zend_object **object, zend_string *method, const zval *key) /* {{{ */
{
- zval zobject;
-
- ZVAL_OBJ(&zobject, *object);
- incomplete_class_message(&zobject, E_ERROR);
+ incomplete_class_message(*object, E_ERROR);
return NULL;
}
/* }}} */
@@ -132,15 +129,14 @@ PHPAPI zend_class_entry *php_create_incomplete_class(void)
/* {{{ php_lookup_class_name
*/
-PHPAPI zend_string *php_lookup_class_name(zval *object)
+PHPAPI zend_string *php_lookup_class_name(zend_object *object)
{
- zval *val;
- HashTable *object_properties;
-
- object_properties = Z_OBJPROP_P(object);
+ if (object->properties) {
+ zval *val = zend_hash_str_find(object->properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER)-1);
- if ((val = zend_hash_str_find(object_properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER)-1)) != NULL && Z_TYPE_P(val) == IS_STRING) {
- return zend_string_copy(Z_STR_P(val));
+ if (val != NULL && Z_TYPE_P(val) == IS_STRING) {
+ return zend_string_copy(Z_STR_P(val));
+ }
}
return NULL;
diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h
index d768f25bdb..eeb4461965 100644
--- a/ext/standard/php_incomplete_class.h
+++ b/ext/standard/php_incomplete_class.h
@@ -27,7 +27,7 @@
#define PHP_SET_CLASS_ATTRIBUTES(struc) \
/* OBJECTS_FIXME: Fix for new object model */ \
if (Z_OBJCE_P(struc) == BG(incomplete_class)) { \
- class_name = php_lookup_class_name(struc); \
+ class_name = php_lookup_class_name(Z_OBJ_P(struc)); \
if (!class_name) { \
class_name = zend_string_init(INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1, 0); \
} \
@@ -51,7 +51,7 @@ extern "C" {
#endif
PHPAPI zend_class_entry *php_create_incomplete_class(void);
-PHPAPI zend_string *php_lookup_class_name(zval *object);
+PHPAPI zend_string *php_lookup_class_name(zend_object *object);
PHPAPI void php_store_class_name(zval *object, const char *name, size_t len);
#ifdef __cplusplus
diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c
index 34e877707c..bc1010243e 100644
--- a/ext/standard/user_filters.c
+++ b/ext/standard/user_filters.c
@@ -164,7 +164,7 @@ php_stream_filter_status_t userfilter_filter(
zval func_name;
zval retval;
zval args[4];
- zval zpropname;
+ zend_string *propname;
int call_result;
/* the userfilter object probably doesn't exist anymore */
@@ -239,9 +239,9 @@ php_stream_filter_status_t userfilter_filter(
/* filter resources are cleaned up by the stream destructor,
* keeping a reference to the stream resource here would prevent it
* from being destroyed properly */
- ZVAL_STRINGL(&zpropname, "stream", sizeof("stream")-1);
- Z_OBJ_HANDLER_P(obj, unset_property)(obj, &zpropname, NULL);
- zval_ptr_dtor(&zpropname);
+ propname = zend_string_init("stream", sizeof("stream")-1, 0);
+ Z_OBJ_HANDLER_P(obj, unset_property)(Z_OBJ_P(obj), propname, NULL);
+ zend_string_release_ex(propname, 0);
zval_ptr_dtor(&args[3]);
zval_ptr_dtor(&args[2]);
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index a7935dbcf1..c2d5a30cfc 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.c
@@ -215,8 +215,8 @@ static void tidy_object_free_storage(zend_object *);
static zend_object *tidy_object_new_node(zend_class_entry *);
static zend_object *tidy_object_new_doc(zend_class_entry *);
static zval * tidy_instanciate(zend_class_entry *, zval *);
-static int tidy_doc_cast_handler(zval *, zval *, int);
-static int tidy_node_cast_handler(zval *, zval *, int);
+static int tidy_doc_cast_handler(zend_object *, zval *, int);
+static int tidy_node_cast_handler(zend_object *, zval *, int);
static void tidy_doc_update_properties(PHPTidyObj *);
static void tidy_add_default_properties(PHPTidyObj *, tidy_obj_type);
static void *php_tidy_get_opt_val(PHPTidyDoc *, TidyOption, TidyOptionType *);
@@ -752,7 +752,7 @@ static zval * tidy_instanciate(zend_class_entry *pce, zval *object)
return object;
}
-static int tidy_doc_cast_handler(zval *in, zval *out, int type)
+static int tidy_doc_cast_handler(zend_object *in, zval *out, int type)
{
TidyBuffer output;
PHPTidyObj *obj;
@@ -772,7 +772,7 @@ static int tidy_doc_cast_handler(zval *in, zval *out, int type)
break;
case IS_STRING:
- obj = Z_TIDY_P(in);
+ obj = php_tidy_fetch_object(in);
tidyBufInit(&output);
tidySaveBuffer (obj->ptdoc->doc, &output);
ZVAL_STRINGL(out, (char *) output.bp, output.size ? output.size-1 : 0);
@@ -786,7 +786,7 @@ static int tidy_doc_cast_handler(zval *in, zval *out, int type)
return SUCCESS;
}
-static int tidy_node_cast_handler(zval *in, zval *out, int type)
+static int tidy_node_cast_handler(zend_object *in, zval *out, int type)
{
TidyBuffer buf;
PHPTidyObj *obj;
@@ -806,7 +806,7 @@ static int tidy_node_cast_handler(zval *in, zval *out, int type)
break;
case IS_STRING:
- obj = Z_TIDY_P(in);
+ obj = php_tidy_fetch_object(in);
tidyBufInit(&buf);
if (obj->ptdoc) {
tidyNodeGetText(obj->ptdoc->doc, obj->node, &buf);
diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c
index 007623f1fc..6e211adc86 100644
--- a/ext/xmlreader/php_xmlreader.c
+++ b/ext/xmlreader/php_xmlreader.c
@@ -114,30 +114,20 @@ static int xmlreader_property_reader(xmlreader_object *obj, xmlreader_prop_handl
/* }}} */
/* {{{ xmlreader_get_property_ptr_ptr */
-zval *xmlreader_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot)
+zval *xmlreader_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot)
{
xmlreader_object *obj;
- zval tmp_member;
zval *retval = NULL;
xmlreader_prop_handler *hnd = NULL;
- if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_STR(&tmp_member, zval_get_string_func(member));
- member = &tmp_member;
- }
-
- obj = Z_XMLREADER_P(object);
+ obj = php_xmlreader_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd == NULL) {
- retval = zend_std_get_property_ptr_ptr(object, member, type, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ retval = zend_std_get_property_ptr_ptr(object, name, type, cache_slot);
}
return retval;
@@ -145,22 +135,16 @@ zval *xmlreader_get_property_ptr_ptr(zval *object, zval *member, int type, void
/* }}} */
/* {{{ xmlreader_read_property */
-zval *xmlreader_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+zval *xmlreader_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
xmlreader_object *obj;
- zval tmp_member;
zval *retval = NULL;
xmlreader_prop_handler *hnd = NULL;
- if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_STR(&tmp_member, zval_get_string_func(member));
- member = &tmp_member;
- }
-
- obj = Z_XMLREADER_P(object);
+ obj = php_xmlreader_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd != NULL) {
@@ -170,41 +154,28 @@ zval *xmlreader_read_property(zval *object, zval *member, int type, void **cache
retval = rv;
}
} else {
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
}
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
return retval;
}
/* }}} */
/* {{{ xmlreader_write_property */
-zval *xmlreader_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+zval *xmlreader_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
xmlreader_object *obj;
- zval tmp_member;
xmlreader_prop_handler *hnd = NULL;
- if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_STR(&tmp_member, zval_get_string_func(member));
- member = &tmp_member;
- }
-
- obj = Z_XMLREADER_P(object);
+ obj = php_xmlreader_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd != NULL) {
php_error_docref(NULL, E_WARNING, "Cannot write to read-only property");
} else {
- value = zend_std_write_property(object, member, value, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ value = zend_std_write_property(object, name, value, cache_slot);
}
return value;
diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c
index d71460efcf..2bb8fc0849 100644
--- a/ext/xsl/xsltprocessor.c
+++ b/ext/xsl/xsltprocessor.c
@@ -397,7 +397,8 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
xsl_object *intern;
int prevSubstValue, prevExtDtdValue, clone_docu = 0;
xmlNode *nodep = NULL;
- zval *cloneDocu, member, rv;
+ zval *cloneDocu, rv;
+ zend_string *member;
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &docp) == FAILURE) {
@@ -433,13 +434,13 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
intern = Z_XSL_P(id);
- ZVAL_STRING(&member, "cloneDocument");
- cloneDocu = zend_std_read_property(id, &member, BP_VAR_IS, NULL, &rv);
+ member = zend_string_init("cloneDocument", sizeof("cloneDocument")-1, 0);
+ cloneDocu = zend_std_read_property(Z_OBJ_P(id), member, BP_VAR_IS, NULL, &rv);
if (Z_TYPE_P(cloneDocu) != IS_NULL) {
convert_to_long(cloneDocu);
clone_docu = Z_LVAL_P(cloneDocu);
}
- zval_ptr_dtor(&member);
+ zend_string_release_ex(member, 0);
if (clone_docu == 0) {
/* check if the stylesheet is using xsl:key, if yes, we have to clone the document _always_ before a transformation */
nodep = xmlDocGetRootElement(sheetp->doc);
@@ -479,7 +480,8 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
php_libxml_node_object *object;
char **params = NULL;
int clone;
- zval *doXInclude, member, rv;
+ zval *doXInclude, rv;
+ zend_string *member;
FILE *f;
int secPrefsError = 0;
int secPrefsValue;
@@ -529,13 +531,13 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
ctxt = xsltNewTransformContext(style, doc);
ctxt->_private = (void *) intern;
- ZVAL_STRING(&member, "doXInclude");
- doXInclude = zend_std_read_property(id, &member, BP_VAR_IS, NULL, &rv);
+ member = zend_string_init("doXInclude", sizeof("doXInclude")-1, 0);
+ doXInclude = zend_std_read_property(Z_OBJ_P(id), member, BP_VAR_IS, NULL, &rv);
if (Z_TYPE_P(doXInclude) != IS_NULL) {
convert_to_long(doXInclude);
ctxt->xinclude = Z_LVAL_P(doXInclude);
}
- zval_ptr_dtor(&member);
+ zend_string_release_ex(member, 0);
secPrefsValue = intern->securityPrefs;
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 9275ab1c46..6c4ada63bd 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -872,54 +872,36 @@ static zval *php_zip_property_reader(ze_zip_object *obj, zip_prop_handler *hnd,
}
/* }}} */
-static zval *php_zip_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static zval *php_zip_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */
{
ze_zip_object *obj;
- zval tmp_member;
zval *retval = NULL;
zip_prop_handler *hnd = NULL;
- if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_STR(&tmp_member, zval_get_string_func(member));
- member = &tmp_member;
- cache_slot = NULL;
- }
-
- obj = Z_ZIP_P(object);
+ obj = php_zip_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd == NULL) {
- retval = zend_std_get_property_ptr_ptr(object, member, type, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ retval = zend_std_get_property_ptr_ptr(object, name, type, cache_slot);
}
return retval;
}
/* }}} */
-static zval *php_zip_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
+static zval *php_zip_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv) /* {{{ */
{
ze_zip_object *obj;
- zval tmp_member;
zval *retval = NULL;
zip_prop_handler *hnd = NULL;
- if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_STR(&tmp_member, zval_get_string_func(member));
- member = &tmp_member;
- cache_slot = NULL;
- }
-
- obj = Z_ZIP_P(object);
+ obj = php_zip_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd != NULL) {
@@ -928,34 +910,23 @@ static zval *php_zip_read_property(zval *object, zval *member, int type, void **
retval = &EG(uninitialized_zval);
}
} else {
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
}
return retval;
}
/* }}} */
-static int php_zip_has_property(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static int php_zip_has_property(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */
{
ze_zip_object *obj;
- zval tmp_member;
zip_prop_handler *hnd = NULL;
int retval = 0;
- if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_STR(&tmp_member, zval_get_string_func(member));
- member = &tmp_member;
- cache_slot = NULL;
- }
-
- obj = Z_ZIP_P(object);
+ obj = php_zip_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd != NULL) {
@@ -973,18 +944,14 @@ static int php_zip_has_property(zval *object, zval *member, int type, void **cac
zval_ptr_dtor(&tmp);
} else {
- retval = zend_std_has_property(object, member, type, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ retval = zend_std_has_property(object, name, type, cache_slot);
}
return retval;
}
/* }}} */
-static HashTable *php_zip_get_gc(zval *object, zval **gc_data, int *gc_data_count) /* {{{ */
+static HashTable *php_zip_get_gc(zend_object *object, zval **gc_data, int *gc_data_count) /* {{{ */
{
*gc_data = NULL;
*gc_data_count = 0;
@@ -992,14 +959,14 @@ static HashTable *php_zip_get_gc(zval *object, zval **gc_data, int *gc_data_coun
}
/* }}} */
-static HashTable *php_zip_get_properties(zval *object)/* {{{ */
+static HashTable *php_zip_get_properties(zend_object *object)/* {{{ */
{
ze_zip_object *obj;
HashTable *props;
zip_prop_handler *hnd;
zend_string *key;
- obj = Z_ZIP_P(object);
+ obj = php_zip_fetch_object(object);
props = zend_std_get_properties(object);
if (obj->prop_handler == NULL) {