summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2015-02-04 15:24:13 +0300
committerDmitry Stogov <dmitry@zend.com>2015-02-04 15:24:13 +0300
commit9e70d7672dd646b8c9b29ccc452e4dc5aa015437 (patch)
tree0b852db11ab8fdcab020d6f13ee631291849b6d2 /ext
parent87377c1707beec44f35cd6d91e5822a31479f170 (diff)
downloadphp-git-9e70d7672dd646b8c9b29ccc452e4dc5aa015437.tar.gz
Move zend_object->guards into additional slot of zend_object->properties_table[]. As result size of objects without __get/__set/__unset/__isset magic methods is reduced.
Diffstat (limited to 'ext')
-rw-r--r--ext/date/php_date.c8
-rw-r--r--ext/dom/php_dom.c4
-rw-r--r--ext/fileinfo/fileinfo.c2
-rw-r--r--ext/gmp/gmp.c3
-rw-r--r--ext/intl/collator/collator_class.c2
-rw-r--r--ext/intl/converter/converter.c2
-rw-r--r--ext/intl/dateformat/dateformat_class.c2
-rw-r--r--ext/intl/formatter/formatter_class.c2
-rw-r--r--ext/intl/msgformat/msgformat_class.c2
-rw-r--r--ext/intl/resourcebundle/resourcebundle_class.c2
-rw-r--r--ext/intl/spoofchecker/spoofchecker_class.c2
-rw-r--r--ext/intl/transliterator/transliterator_class.c2
-rw-r--r--ext/mysqli/mysqli.c2
-rw-r--r--ext/pdo/pdo_dbh.c2
-rw-r--r--ext/pdo/pdo_stmt.c4
-rw-r--r--ext/reflection/php_reflection.c4
-rw-r--r--ext/simplexml/simplexml.c2
-rw-r--r--ext/snmp/snmp.c2
-rw-r--r--ext/spl/spl_array.c2
-rw-r--r--ext/spl/spl_directory.c2
-rw-r--r--ext/spl/spl_dllist.c2
-rw-r--r--ext/spl/spl_fixedarray.c2
-rw-r--r--ext/spl/spl_heap.c2
-rw-r--r--ext/spl/spl_iterators.c4
-rw-r--r--ext/spl/spl_observer.c2
-rw-r--r--ext/sqlite3/sqlite3.c6
-rw-r--r--ext/tidy/tidy.c2
-rw-r--r--ext/xmlreader/php_xmlreader.c2
-rw-r--r--ext/xmlwriter/php_xmlwriter.c2
-rw-r--r--ext/xsl/php_xsl.c2
-rw-r--r--ext/zip/php_zip.c2
31 files changed, 40 insertions, 41 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index a00c4c5a94..a89636c36c 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -2069,7 +2069,7 @@ static inline zend_object *date_object_new_date_ex(zend_class_entry *class_type,
{
php_date_obj *intern;
- intern = ecalloc(1, sizeof(php_date_obj) + sizeof(zval) * (class_type->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(php_date_obj) + zend_object_properties_size(class_type));
zend_object_std_init(&intern->std, class_type);
if (init_props) {
@@ -2200,7 +2200,7 @@ static inline zend_object *date_object_new_timezone_ex(zend_class_entry *class_t
{
php_timezone_obj *intern;
- intern = ecalloc(1, sizeof(php_timezone_obj) + sizeof(zval) * (class_type->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(php_timezone_obj) + zend_object_properties_size(class_type));
zend_object_std_init(&intern->std, class_type);
if (init_props) {
@@ -2291,7 +2291,7 @@ static inline zend_object *date_object_new_interval_ex(zend_class_entry *class_t
{
php_interval_obj *intern;
- intern = ecalloc(1, sizeof(php_interval_obj) + sizeof(zval) * (class_type->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(php_interval_obj) + zend_object_properties_size(class_type));
zend_object_std_init(&intern->std, class_type);
if (init_props) {
@@ -2372,7 +2372,7 @@ static inline zend_object *date_object_new_period_ex(zend_class_entry *class_typ
{
php_period_obj *intern;
- intern = ecalloc(1, sizeof(php_period_obj) + sizeof(zval) * (class_type->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(php_period_obj) + zend_object_properties_size(class_type));
zend_object_std_init(&intern->std, class_type);
if (init_props) {
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index 6797e894b5..b6b66fc507 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -1081,7 +1081,7 @@ void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xml
static dom_object* dom_objects_set_class(zend_class_entry *class_type, zend_bool hash_copy) /* {{{ */
{
- dom_object *intern = ecalloc(1, sizeof(dom_object) + sizeof(zval) * (class_type->default_properties_count - 1));
+ dom_object *intern = ecalloc(1, sizeof(dom_object) + zend_object_properties_size(class_type));
zend_class_entry *base_class = class_type;
while (base_class->type != ZEND_INTERNAL_CLASS && base_class->parent != NULL) {
@@ -1112,7 +1112,7 @@ zend_object *dom_objects_new(zend_class_entry *class_type)
/* {{{ zend_object_value dom_xpath_objects_new(zend_class_entry *class_type) */
zend_object *dom_xpath_objects_new(zend_class_entry *class_type)
{
- dom_xpath_object *intern = ecalloc(1, sizeof(dom_xpath_object) + sizeof(zval) * (class_type->default_properties_count - 1));
+ dom_xpath_object *intern = ecalloc(1, sizeof(dom_xpath_object) + zend_object_properties_size(class_type));
ALLOC_HASHTABLE(intern->registered_phpfunctions);
zend_hash_init(intern->registered_phpfunctions, 0, NULL, ZVAL_PTR_DTOR, 0);
diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c
index f9eebd0484..b4a556d57b 100644
--- a/ext/fileinfo/fileinfo.c
+++ b/ext/fileinfo/fileinfo.c
@@ -103,7 +103,7 @@ PHP_FILEINFO_API zend_object *finfo_objects_new(zend_class_entry *class_type)
{
finfo_object *intern;
- intern = ecalloc(1, sizeof(finfo_object) + sizeof(zval) * (class_type->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(finfo_object) + zend_object_properties_size(class_type));
zend_object_std_init(&intern->zo, class_type);
object_properties_init(&intern->zo, class_type);
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
index f4742a6cce..75b157b890 100644
--- a/ext/gmp/gmp.c
+++ b/ext/gmp/gmp.c
@@ -378,8 +378,7 @@ static void gmp_free_object_storage(zend_object *obj) /* {{{ */
static inline zend_object *gmp_create_object_ex(zend_class_entry *ce, mpz_ptr *gmpnum_target) /* {{{ */
{
- gmp_object *intern = emalloc(sizeof(gmp_object)
- + sizeof(zval) * (ce->default_properties_count - 1));
+ gmp_object *intern = emalloc(sizeof(gmp_object) + zend_object_properties_size(ce));
zend_object_std_init(&intern->std, ce);
object_properties_init(&intern->std, ce);
diff --git a/ext/intl/collator/collator_class.c b/ext/intl/collator/collator_class.c
index 48fc368060..4fc7067708 100644
--- a/ext/intl/collator/collator_class.c
+++ b/ext/intl/collator/collator_class.c
@@ -58,7 +58,7 @@ zend_object *Collator_object_create(zend_class_entry *ce )
{
Collator_object* intern;
- intern = ecalloc(1, sizeof(Collator_object) + sizeof(zval) * (ce->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(Collator_object) + zend_object_properties_size(ce));
intl_error_init(COLLATOR_ERROR_P(intern));
zend_object_std_init(&intern->zo, ce );
object_properties_init(&intern->zo, ce);
diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c
index a02edd4efe..9bba427409 100644
--- a/ext/intl/converter/converter.c
+++ b/ext/intl/converter/converter.c
@@ -1033,7 +1033,7 @@ static void php_converter_dtor_object(zend_object *obj) {
static zend_object *php_converter_object_ctor(zend_class_entry *ce, php_converter_object **pobjval) {
php_converter_object *objval;
- objval = ecalloc(1, sizeof(php_converter_object) + sizeof(zval) * (ce->default_properties_count - 1));
+ objval = ecalloc(1, sizeof(php_converter_object) + zend_object_properties_size(ce));
zend_object_std_init(&objval->obj, ce );
intl_error_init(&(objval->error));
diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c
index a10b6defc5..afdde13dec 100644
--- a/ext/intl/dateformat/dateformat_class.c
+++ b/ext/intl/dateformat/dateformat_class.c
@@ -61,7 +61,7 @@ zend_object *IntlDateFormatter_object_create(zend_class_entry *ce)
{
IntlDateFormatter_object* intern;
- intern = ecalloc( 1, sizeof(IntlDateFormatter_object) + sizeof(zval) * (ce->default_properties_count - 1) );
+ intern = ecalloc( 1, sizeof(IntlDateFormatter_object) + zend_object_properties_size(ce));
dateformat_data_init( &intern->datef_data );
zend_object_std_init( &intern->zo, ce );
object_properties_init(&intern->zo, ce);
diff --git a/ext/intl/formatter/formatter_class.c b/ext/intl/formatter/formatter_class.c
index df1086573f..287d19aaa9 100644
--- a/ext/intl/formatter/formatter_class.c
+++ b/ext/intl/formatter/formatter_class.c
@@ -56,7 +56,7 @@ zend_object *NumberFormatter_object_create(zend_class_entry *ce)
{
NumberFormatter_object* intern;
- intern = ecalloc( 1, sizeof(NumberFormatter_object) + sizeof(zval) * (ce->default_properties_count - 1) );
+ intern = ecalloc( 1, sizeof(NumberFormatter_object) + zend_object_properties_size(ce));
formatter_data_init( &intern->nf_data );
zend_object_std_init( &intern->zo, ce );
object_properties_init(&intern->zo, ce);
diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c
index bb66bb4ba1..8d464c6ca4 100644
--- a/ext/intl/msgformat/msgformat_class.c
+++ b/ext/intl/msgformat/msgformat_class.c
@@ -56,7 +56,7 @@ zend_object *MessageFormatter_object_create(zend_class_entry *ce)
{
MessageFormatter_object* intern;
- intern = ecalloc( 1, sizeof(MessageFormatter_object) + sizeof(zval) * (ce->default_properties_count - 1));
+ intern = ecalloc( 1, sizeof(MessageFormatter_object) + zend_object_properties_size(ce));
msgformat_data_init( &intern->mf_data );
zend_object_std_init( &intern->zo, ce );
object_properties_init(&intern->zo, ce);
diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c
index 9ce33736bb..b8d27c940a 100644
--- a/ext/intl/resourcebundle/resourcebundle_class.c
+++ b/ext/intl/resourcebundle/resourcebundle_class.c
@@ -58,7 +58,7 @@ static zend_object *ResourceBundle_object_create( zend_class_entry *ce )
{
ResourceBundle_object *rb;
- rb = ecalloc( 1, sizeof(ResourceBundle_object) + sizeof(zval) * (ce->default_properties_count - 1) );
+ rb = ecalloc( 1, sizeof(ResourceBundle_object) + zend_object_properties_size(ce));
zend_object_std_init( &rb->zend, ce );
object_properties_init( &rb->zend, ce);
diff --git a/ext/intl/spoofchecker/spoofchecker_class.c b/ext/intl/spoofchecker/spoofchecker_class.c
index d2f2b4c873..d93c709bd7 100644
--- a/ext/intl/spoofchecker/spoofchecker_class.c
+++ b/ext/intl/spoofchecker/spoofchecker_class.c
@@ -53,7 +53,7 @@ zend_object *Spoofchecker_object_create(
{
Spoofchecker_object* intern;
- intern = ecalloc(1, sizeof(Spoofchecker_object) + sizeof(zval) * (ce->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(Spoofchecker_object) + zend_object_properties_size(ce));
intl_error_init(SPOOFCHECKER_ERROR_P(intern));
zend_object_std_init(&intern->zo, ce);
object_properties_init(&intern->zo, ce);
diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c
index c40c5e33ce..4395cc086a 100644
--- a/ext/intl/transliterator/transliterator_class.c
+++ b/ext/intl/transliterator/transliterator_class.c
@@ -121,7 +121,7 @@ static zend_object *Transliterator_object_create(
{
Transliterator_object* intern;
- intern = ecalloc( 1, sizeof( Transliterator_object ) + sizeof(zval) * (ce->default_properties_count - 1));
+ intern = ecalloc( 1, sizeof( Transliterator_object ) + zend_object_properties_size(ce));
zend_object_std_init( &intern->zo, ce );
object_properties_init( &intern->zo, ce );
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index 2debf256e2..9be31960c5 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -453,7 +453,7 @@ PHP_MYSQLI_EXPORT(zend_object *) mysqli_objects_new(zend_class_entry *class_type
zend_class_entry *mysqli_base_class;
zend_object_handlers *handlers;
- intern = ecalloc(1, sizeof(mysqli_object) + sizeof(zval) * (class_type->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(mysqli_object) + zend_object_properties_size(class_type));
mysqli_base_class = class_type;
while (mysqli_base_class->type != ZEND_INTERNAL_CLASS &&
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index 1e282d0b43..de9a6abbdc 100644
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -1544,7 +1544,7 @@ zend_object *pdo_dbh_new(zend_class_entry *ce)
{
pdo_dbh_object_t *dbh;
- dbh = ecalloc(1, sizeof(pdo_dbh_object_t) + sizeof(zval) * (ce->default_properties_count - 1));
+ dbh = ecalloc(1, sizeof(pdo_dbh_object_t) + zend_object_properties_size(ce));
zend_object_std_init(&dbh->std, ce);
object_properties_init(&dbh->std, ce);
rebuild_object_properties(&dbh->std);
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index dc1201ccda..c6ebc37ec2 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -2254,7 +2254,7 @@ static zend_object *dbstmt_clone_obj(zval *zobject)
pdo_stmt_t *stmt;
pdo_stmt_t *old_stmt;
- stmt = ecalloc(1, sizeof(pdo_stmt_t) + sizeof(zval) * (Z_OBJCE_P(zobject)->default_properties_count - 1));
+ stmt = ecalloc(1, sizeof(pdo_stmt_t) + zend_object_properties_size(Z_OBJCE_P(zobject)));
zend_object_std_init(&stmt->std, Z_OBJCE_P(zobject));
object_properties_init(&stmt->std, Z_OBJCE_P(zobject));
@@ -2357,7 +2357,7 @@ zend_object *pdo_dbstmt_new(zend_class_entry *ce)
{
pdo_stmt_t *stmt;
- stmt = ecalloc(1, sizeof(pdo_stmt_t) + sizeof(zval) * (ce->default_properties_count - 1));
+ stmt = ecalloc(1, sizeof(pdo_stmt_t) + zend_object_properties_size(ce));
zend_object_std_init(&stmt->std, ce);
object_properties_init(&stmt->std, ce);
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 9f5ad8cdd4..194c7ee99b 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -329,7 +329,7 @@ static zend_object *reflection_objects_new(zend_class_entry *class_type) /* {{{
{
reflection_object *intern;
- intern = ecalloc(1, sizeof(reflection_object) + sizeof(zval) * (class_type->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(reflection_object) + zend_object_properties_size(class_type));
intern->zo.ce = class_type;
zend_object_std_init(&intern->zo, class_type);
@@ -4217,7 +4217,7 @@ ZEND_METHOD(reflection_class, getModifiers)
}
GET_REFLECTION_OBJECT_PTR(ce);
- RETURN_LONG(ce->ce_flags & ~ZEND_ACC_CONSTANTS_UPDATED);
+ RETURN_LONG(ce->ce_flags & ~(ZEND_ACC_CONSTANTS_UPDATED|ZEND_ACC_USE_GUARDS));
}
/* }}} */
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index ceba129560..b125d16f71 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -2057,7 +2057,7 @@ static php_sxe_object* php_sxe_object_new(zend_class_entry *ce)
zend_class_entry *parent = ce;
int inherited = 0;
- intern = ecalloc(1, sizeof(php_sxe_object) + sizeof(zval) * (parent->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(php_sxe_object) + zend_object_properties_size(parent));
intern->iter.type = SXE_ITER_NONE;
intern->iter.nsprefix = NULL;
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index ab8a25b9af..930affa041 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -493,7 +493,7 @@ static zend_object *php_snmp_object_new(zend_class_entry *class_type) /* {{{ */
php_snmp_object *intern;
/* Allocate memory for it */
- intern = ecalloc(1, sizeof(php_snmp_object) + sizeof(zval) * (class_type->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(php_snmp_object) + zend_object_properties_size(class_type));
zend_object_std_init(&intern->zo, class_type);
object_properties_init(&intern->zo, class_type);
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 38a4aaede2..0ae066dbfb 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -181,7 +181,7 @@ static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zval *
zend_class_entry *parent = class_type;
int inherited = 0;
- intern = ecalloc(1, sizeof(spl_array_object) + sizeof(zval) * (parent->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(spl_array_object) + zend_object_properties_size(parent));
zend_object_std_init(&intern->std, class_type);
object_properties_init(&intern->std, class_type);
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index e2a836bfa3..a7d699b635 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -143,7 +143,7 @@ static zend_object *spl_filesystem_object_new_ex(zend_class_entry *class_type)
{
spl_filesystem_object *intern;
- intern = ecalloc(1, sizeof(spl_filesystem_object) + sizeof(zval) * (class_type->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(spl_filesystem_object) + zend_object_properties_size(class_type));
/* intern->type = SPL_FS_INFO; done by set 0 */
intern->file_class = spl_ce_SplFileObject;
intern->info_class = spl_ce_SplFileInfo;
diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c
index 8dbd11df22..3db7628837 100644
--- a/ext/spl/spl_dllist.c
+++ b/ext/spl/spl_dllist.c
@@ -373,7 +373,7 @@ static zend_object *spl_dllist_object_new_ex(zend_class_entry *class_type, zval
zend_class_entry *parent = class_type;
int inherited = 0;
- intern = ecalloc(1, sizeof(spl_dllist_object) + sizeof(zval) * (parent->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(spl_dllist_object) + zend_object_properties_size(parent));
zend_object_std_init(&intern->std, class_type);
object_properties_init(&intern->std, class_type);
diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c
index a974a2008f..cd83a17b56 100644
--- a/ext/spl/spl_fixedarray.c
+++ b/ext/spl/spl_fixedarray.c
@@ -220,7 +220,7 @@ static zend_object *spl_fixedarray_object_new_ex(zend_class_entry *class_type, z
zend_class_entry *parent = class_type;
int inherited = 0;
- intern = ecalloc(1, sizeof(spl_fixedarray_object) + (sizeof(zval) * parent->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(spl_fixedarray_object) + zend_object_properties_size(parent));
zend_object_std_init(&intern->std, class_type);
object_properties_init(&intern->std, class_type);
diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c
index 35e2806f7c..8e9f3ad66f 100644
--- a/ext/spl/spl_heap.c
+++ b/ext/spl/spl_heap.c
@@ -386,7 +386,7 @@ static zend_object *spl_heap_object_new_ex(zend_class_entry *class_type, zval *o
zend_class_entry *parent = class_type;
int inherited = 0;
- intern = ecalloc(1, sizeof(spl_heap_object) + sizeof(zval) * (parent->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(spl_heap_object) + zend_object_properties_size(parent));
zend_object_std_init(&intern->std, class_type);
object_properties_init(&intern->std, class_type);
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 80dcabb907..bb7424a395 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -948,7 +948,7 @@ static zend_object *spl_RecursiveIteratorIterator_new_ex(zend_class_entry *class
{
spl_recursive_it_object *intern;
- intern = ecalloc(1, sizeof(spl_recursive_it_object) + sizeof(zval) * (class_type->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(spl_recursive_it_object) + zend_object_properties_size(class_type));
if (init_prefix) {
smart_str_appendl(&intern->prefix[0], "", 0);
@@ -2377,7 +2377,7 @@ static zend_object *spl_dual_it_new(zend_class_entry *class_type)
{
spl_dual_it_object *intern;
- intern = ecalloc(1, sizeof(spl_dual_it_object) + sizeof(zval) * (class_type->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(spl_dual_it_object) + zend_object_properties_size(class_type));
intern->dit_type = DIT_Unknown;
zend_object_std_init(&intern->std, class_type);
diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c
index 929b20d5d8..9c63b448c6 100644
--- a/ext/spl/spl_observer.c
+++ b/ext/spl/spl_observer.c
@@ -256,7 +256,7 @@ static zend_object *spl_object_storage_new_ex(zend_class_entry *class_type, zval
spl_SplObjectStorage *intern;
zend_class_entry *parent = class_type;
- intern = emalloc(sizeof(spl_SplObjectStorage) + sizeof(zval) * (parent->default_properties_count - 1));
+ intern = emalloc(sizeof(spl_SplObjectStorage) + zend_object_properties_size(parent));
memset(intern, 0, sizeof(spl_SplObjectStorage) - sizeof(zval));
intern->pos = INVALID_IDX;
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index 31b9f1aa5b..556f7861f6 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -2113,7 +2113,7 @@ static zend_object *php_sqlite3_object_new(zend_class_entry *class_type) /* {{{
php_sqlite3_db_object *intern;
/* Allocate memory for it */
- intern = ecalloc(1, sizeof(php_sqlite3_db_object) + sizeof(zval) * (class_type->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(php_sqlite3_db_object) + zend_object_properties_size(class_type));
/* Need to keep track of things to free */
zend_llist_init(&(intern->free_list), sizeof(php_sqlite3_free_list *), (llist_dtor_func_t)php_sqlite3_free_list_dtor, 0);
@@ -2132,7 +2132,7 @@ static zend_object *php_sqlite3_stmt_object_new(zend_class_entry *class_type) /*
php_sqlite3_stmt *intern;
/* Allocate memory for it */
- intern = ecalloc(1, sizeof(php_sqlite3_stmt) + sizeof(zval) * (class_type->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(php_sqlite3_stmt) + zend_object_properties_size(class_type));
zend_object_std_init(&intern->zo, class_type);
object_properties_init(&intern->zo, class_type);
@@ -2148,7 +2148,7 @@ static zend_object *php_sqlite3_result_object_new(zend_class_entry *class_type)
php_sqlite3_result *intern;
/* Allocate memory for it */
- intern = ecalloc(1, sizeof(php_sqlite3_result) + sizeof(zval) * (class_type->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(php_sqlite3_result) + zend_object_properties_size(class_type));
zend_object_std_init(&intern->zo, class_type);
object_properties_init(&intern->zo, class_type);
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index 03d8dd4b9a..b0fe2935a0 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.c
@@ -677,7 +677,7 @@ static zend_object *tidy_object_new(zend_class_entry *class_type, zend_object_ha
{
PHPTidyObj *intern;
- intern = ecalloc(1, sizeof(PHPTidyObj) + sizeof(zval) * (class_type->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(PHPTidyObj) + zend_object_properties_size(class_type));
zend_object_std_init(&intern->std, class_type);
object_properties_init(&intern->std, class_type);
diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c
index af34f08cc2..b572c85ada 100644
--- a/ext/xmlreader/php_xmlreader.c
+++ b/ext/xmlreader/php_xmlreader.c
@@ -385,7 +385,7 @@ zend_object *xmlreader_objects_new(zend_class_entry *class_type)
{
xmlreader_object *intern;
- intern = ecalloc(1, sizeof(xmlreader_object) + sizeof(zval) * (class_type->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(xmlreader_object) + zend_object_properties_size(class_type));
zend_object_std_init(&intern->std, class_type);
object_properties_init(&intern->std, class_type);
intern->prop_handler = &xmlreader_prop_handlers;
diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c
index 9e79e14ea5..f2e458f64f 100644
--- a/ext/xmlwriter/php_xmlwriter.c
+++ b/ext/xmlwriter/php_xmlwriter.c
@@ -141,7 +141,7 @@ static zend_object *xmlwriter_object_new(zend_class_entry *class_type)
{
ze_xmlwriter_object *intern;
- intern = ecalloc(1, sizeof(ze_xmlwriter_object) + sizeof(zval) * (class_type->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(ze_xmlwriter_object) + zend_object_properties_size(class_type));
zend_object_std_init(&intern->std, class_type);
object_properties_init(&intern->std, class_type);
intern->std.handlers = &xmlwriter_object_handlers;
diff --git a/ext/xsl/php_xsl.c b/ext/xsl/php_xsl.c
index 0f665c937e..793c0fc6db 100644
--- a/ext/xsl/php_xsl.c
+++ b/ext/xsl/php_xsl.c
@@ -114,7 +114,7 @@ zend_object *xsl_objects_new(zend_class_entry *class_type)
{
xsl_object *intern;
- intern = ecalloc(1, sizeof(xsl_object) + sizeof(zval) * (class_type->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(xsl_object) + zend_object_properties_size(class_type));
intern->securityPrefs = XSL_SECPREF_DEFAULT;
zend_object_std_init(&intern->std, class_type);
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 927e66e794..e90ee9f979 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -1014,7 +1014,7 @@ static zend_object *php_zip_object_new(zend_class_entry *class_type) /* {{{ */
{
ze_zip_object *intern;
- intern = ecalloc(1, sizeof(ze_zip_object) + sizeof(zval) * (class_type->default_properties_count - 1));
+ intern = ecalloc(1, sizeof(ze_zip_object) + zend_object_properties_size(class_type));
intern->prop_handler = &zip_prop_handlers;
zend_object_std_init(&intern->zo, class_type);
object_properties_init(&intern->zo, class_type);