@@ -129,7 +129,7 @@ static const char *zend_get_property_name(const zend_property_info *property_inf
129
129
130
130
static void zend_duplicate_property_info (zend_property_info * property_info ) /* {{{ */
131
131
{
132
- zend_accessor_info * parent_ai = property_info -> ai ;
132
+ zend_function * * orig_accs = property_info -> accs ;
133
133
134
134
if (!IS_INTERNED (property_info -> name )) {
135
135
property_info -> name = estrndup (property_info -> name , property_info -> name_length );
@@ -138,14 +138,13 @@ static void zend_duplicate_property_info(zend_property_info *property_info) /* {
138
138
property_info -> doc_comment = estrndup (property_info -> doc_comment , property_info -> doc_comment_len );
139
139
}
140
140
141
- if (parent_ai ) {
141
+ if (orig_accs ) {
142
142
int i ;
143
143
144
- property_info -> ai = ecalloc (1 , sizeof (zend_accessor_info ));
145
-
144
+ property_info -> accs = ecalloc (ZEND_ACCESSOR_COUNT , sizeof (zend_function * ));
146
145
for (i = 0 ; i < ZEND_ACCESSOR_COUNT ; ++ i ) {
147
- if (parent_ai -> fn [i ]) {
148
- property_info -> ai -> fn [i ] = duplicate_accessor_function (parent_ai -> fn [i ]);
146
+ if (orig_accs [i ]) {
147
+ property_info -> accs [i ] = duplicate_accessor_function (orig_accs [i ]);
149
148
}
150
149
}
151
150
}
@@ -167,19 +166,18 @@ static void zend_destroy_property_info(zend_property_info *property_info) /* {{{
167
166
efree ((char * )property_info -> doc_comment );
168
167
}
169
168
170
- if (property_info -> ai ) {
171
- zend_accessor_info * ai = property_info -> ai ;
169
+ if (property_info -> accs ) {
170
+ zend_function * * accs = property_info -> accs ;
172
171
int i ;
173
-
174
- TSRMLS_FETCH (); /* Need to check how to avoid this tsrm fetch */
172
+ TSRMLS_FETCH ();
175
173
176
174
for (i = 0 ; i < ZEND_ACCESSOR_COUNT ; ++ i ) {
177
- if (ai -> fn [i ]) {
178
- destroy_op_array ((zend_op_array * ) ai -> fn [i ] TSRMLS_CC );
175
+ if (accs [i ]) {
176
+ destroy_op_array ((zend_op_array * ) accs [i ] TSRMLS_CC );
179
177
}
180
178
}
181
179
182
- efree (ai );
180
+ efree (accs );
183
181
}
184
182
}
185
183
/* }}} */
@@ -1591,14 +1589,9 @@ void zend_declare_accessor(znode *var_name TSRMLS_DC) { /* {{{ */
1591
1589
CG (active_class_entry )-> ce_flags = orig_ce_flags ;
1592
1590
1593
1591
if (zend_hash_find (& CG (active_class_entry )-> properties_info , property_name , property_name_len + 1 , (void * * ) & property_info )== SUCCESS ) {
1594
- if (property_info -> ai != NULL ) {
1595
- zend_error_noreturn (E_COMPILE_ERROR , "property_info for %s::$%s already has accessor_info created, should not happen in zend_declare_accessor()" , CG (active_class_entry )-> name , property_name );
1596
- }
1597
-
1598
- property_info -> ai = ecalloc (1 , sizeof (zend_accessor_info ));
1599
-
1600
1592
/* Add back final/abstract flags that were skipped previously */
1601
1593
property_info -> flags |= CG (access_type );
1594
+ property_info -> accs = ecalloc (ZEND_ACCESSOR_COUNT , sizeof (zend_function * ));
1602
1595
1603
1596
CG (current_property_info ) = property_info ;
1604
1597
efree (property_name );
@@ -1643,7 +1636,7 @@ void zend_do_begin_accessor_declaration(znode *function_token, znode *modifiers,
1643
1636
1644
1637
/* Declare Function */
1645
1638
zend_do_begin_function_declaration (function_token , function_token , 1 , return_reference , modifiers TSRMLS_CC );
1646
- property_info -> ai -> fn [ZEND_ACCESSOR_GET ] = (zend_function * ) CG (active_op_array );
1639
+ property_info -> accs [ZEND_ACCESSOR_GET ] = (zend_function * ) CG (active_op_array );
1647
1640
} else if (Z_TYPE (function_token -> u .constant ) == IS_STRING && strcasecmp ("set" , Z_STRVAL (function_token -> u .constant )) == 0 ) {
1648
1641
znode unused_node , unused_node2 , value_node ;
1649
1642
@@ -1655,7 +1648,7 @@ void zend_do_begin_accessor_declaration(znode *function_token, znode *modifiers,
1655
1648
}
1656
1649
/* Declare Function */
1657
1650
zend_do_begin_function_declaration (function_token , function_token , 1 , ZEND_RETURN_VAL , modifiers TSRMLS_CC );
1658
- property_info -> ai -> fn [ZEND_ACCESSOR_SET ] = (zend_function * ) CG (active_op_array );
1651
+ property_info -> accs [ZEND_ACCESSOR_SET ] = (zend_function * ) CG (active_op_array );
1659
1652
1660
1653
if (!has_params ) {
1661
1654
/* Add $value parameter to __setHours() */
@@ -1675,7 +1668,7 @@ void zend_do_begin_accessor_declaration(znode *function_token, znode *modifiers,
1675
1668
1676
1669
/* Declare Function */
1677
1670
zend_do_begin_function_declaration (function_token , function_token , 1 , ZEND_RETURN_VAL , modifiers TSRMLS_CC );
1678
- property_info -> ai -> fn [ZEND_ACCESSOR_ISSET ] = (zend_function * ) CG (active_op_array );
1671
+ property_info -> accs [ZEND_ACCESSOR_ISSET ] = (zend_function * ) CG (active_op_array );
1679
1672
} else if (Z_TYPE (function_token -> u .constant ) == IS_LONG && Z_LVAL (function_token -> u .constant ) == T_UNSET ) {
1680
1673
ZVAL_STRING (& function_token -> u .constant , create_accessor_function_name (property_name , "unset" ), 0 );
1681
1674
@@ -1685,7 +1678,7 @@ void zend_do_begin_accessor_declaration(znode *function_token, znode *modifiers,
1685
1678
1686
1679
/* Declare Function */
1687
1680
zend_do_begin_function_declaration (function_token , function_token , 1 , ZEND_RETURN_VAL , modifiers TSRMLS_CC );
1688
- property_info -> ai -> fn [ZEND_ACCESSOR_UNSET ] = (zend_function * ) CG (active_op_array );
1681
+ property_info -> accs [ZEND_ACCESSOR_UNSET ] = (zend_function * ) CG (active_op_array );
1689
1682
} else {
1690
1683
zend_error (E_COMPILE_ERROR , "Unknown accessor '%s', expecting get or set for variable $%s" , Z_STRVAL (function_token -> u .constant ), property_name );
1691
1684
}
@@ -1708,7 +1701,7 @@ void zend_do_end_accessor_declaration(znode *function_token, const znode *body T
1708
1701
* ->fn slot it is in */
1709
1702
zend_uchar acc ;
1710
1703
for (acc = 0 ; acc < ZEND_ACCESSOR_COUNT ; ++ acc ) {
1711
- if (property_info -> ai -> fn [acc ] == (zend_function * ) CG (active_op_array )) {
1704
+ if (property_info -> accs [acc ] == (zend_function * ) CG (active_op_array )) {
1712
1705
break ;
1713
1706
}
1714
1707
}
@@ -1774,7 +1767,7 @@ void zend_do_end_accessor_declaration(znode *function_token, const znode *body T
1774
1767
void zend_finalize_accessor (TSRMLS_D ) { /* {{{ */
1775
1768
zend_property_info * property_info = CG (current_property_info );
1776
1769
1777
- if (!property_info -> ai -> fn [ZEND_ACCESSOR_ISSET ] && property_info -> ai -> fn [ZEND_ACCESSOR_GET ]) {
1770
+ if (!property_info -> accs [ZEND_ACCESSOR_ISSET ] && property_info -> accs [ZEND_ACCESSOR_GET ]) {
1778
1771
znode zn_fntoken , zn_modifiers , zn_body ;
1779
1772
INIT_ZNODE (zn_fntoken );
1780
1773
ZVAL_LONG (& zn_fntoken .u .constant , T_ISSET );
@@ -1788,7 +1781,7 @@ void zend_finalize_accessor(TSRMLS_D) { /* {{{ */
1788
1781
zend_do_begin_accessor_declaration (& zn_fntoken , & zn_modifiers , 0 , 0 TSRMLS_CC );
1789
1782
zend_do_end_accessor_declaration (& zn_fntoken , & zn_body TSRMLS_CC );
1790
1783
}
1791
- if (!property_info -> ai -> fn [ZEND_ACCESSOR_UNSET ] && property_info -> ai -> fn [ZEND_ACCESSOR_SET ]) {
1784
+ if (!property_info -> accs [ZEND_ACCESSOR_UNSET ] && property_info -> accs [ZEND_ACCESSOR_SET ]) {
1792
1785
znode zn_fntoken , zn_modifiers , zn_body ;
1793
1786
INIT_ZNODE (zn_fntoken );
1794
1787
ZVAL_LONG (& zn_fntoken .u .constant , T_UNSET );
@@ -3789,23 +3782,23 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
3789
3782
ce -> default_properties_table [child_info -> offset ] = NULL ;
3790
3783
child_info -> offset = parent_info -> offset ;
3791
3784
3792
- if (parent_info -> ai && child_info -> ai ) {
3785
+ if (parent_info -> accs && child_info -> accs ) {
3793
3786
int i ;
3794
3787
TSRMLS_FETCH ();
3795
3788
3796
3789
for (i = 0 ; i < ZEND_ACCESSOR_COUNT ; ++ i ) {
3797
- do_inherit_accessor (& child_info -> ai -> fn [i ], parent_info -> ai -> fn [i ], ce TSRMLS_CC );
3790
+ do_inherit_accessor (& child_info -> accs [i ], parent_info -> accs [i ], ce TSRMLS_CC );
3798
3791
}
3799
3792
}
3800
3793
}
3801
3794
return 0 ; /* Don't copy from parent */
3802
3795
} else {
3803
3796
/* Make sure that when we copy abstract accessors the class is marked
3804
3797
* abstract too */
3805
- if (parent_info -> ai ) {
3798
+ if (parent_info -> accs ) {
3806
3799
int i ;
3807
3800
for (i = 0 ; i < ZEND_ACCESSOR_COUNT ; ++ i ) {
3808
- zend_function * fn = parent_info -> ai -> fn [i ];
3801
+ zend_function * fn = parent_info -> accs [i ];
3809
3802
if (fn && (fn -> common .fn_flags & ZEND_ACC_ABSTRACT )) {
3810
3803
ce -> ce_flags |= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS ;
3811
3804
}
@@ -4640,14 +4633,14 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
4640
4633
zend_declare_property_ex (ce , prop_name , prop_name_length ,
4641
4634
prop_value , flags ,
4642
4635
doc_comment , property_info -> doc_comment_len TSRMLS_CC );
4643
- if (property_info -> ai ) {
4636
+ if (property_info -> accs ) {
4644
4637
zend_property_info * created_property_info ;
4645
4638
if (zend_hash_find (& ce -> properties_info , prop_name , prop_name_length + 1 , (void * * ) & created_property_info ) == SUCCESS ) {
4646
4639
int j ;
4647
- created_property_info -> ai = ecalloc (1 , sizeof (zend_accessor_info ));
4640
+ created_property_info -> accs = ecalloc (ZEND_ACCESSOR_COUNT , sizeof (zend_function * ));
4648
4641
4649
4642
for (j = 0 ; j < ZEND_ACCESSOR_COUNT ; ++ j ) {
4650
- zend_do_trait_inherit_accessor (& created_property_info -> ai -> fn [j ], property_info -> ai -> fn [j ], ce , ce -> traits [i ], & overridden TSRMLS_CC );
4643
+ zend_do_trait_inherit_accessor (& created_property_info -> accs [j ], property_info -> accs [j ], ce , ce -> traits [i ], & overridden TSRMLS_CC );
4651
4644
}
4652
4645
}
4653
4646
}
0 commit comments