Skip to content

Commit 2019467

Browse files
committed
Fix zts build, fix reflection sigsegv, fix issue php#42
No more ai->flags, now merged into prop->flags. I think now the whole ai thing can be removed. We should just have a zend_function **acc in the property_info instead.
1 parent d4cef99 commit 2019467

File tree

4 files changed

+9
-20
lines changed

4 files changed

+9
-20
lines changed

Zend/zend_compile.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ static void zend_duplicate_property_info(zend_property_info *property_info) /* {
142142
int i;
143143

144144
property_info->ai = ecalloc(1, sizeof(zend_accessor_info));
145-
property_info->ai->flags = parent_ai->flags;
146145

147146
for (i = 0; i < ZEND_ACCESSOR_COUNT; ++i) {
148147
if (parent_ai->fn[i]) {
@@ -1597,7 +1596,9 @@ void zend_declare_accessor(znode *var_name TSRMLS_DC) { /* {{{ */
15971596
}
15981597

15991598
property_info->ai = ecalloc(1, sizeof(zend_accessor_info));
1600-
property_info->ai->flags = CG(access_type);
1599+
1600+
/* Add back final/abstract flags that were skipped previously */
1601+
property_info->flags |= CG(access_type);
16011602

16021603
CG(current_property_info) = property_info;
16031604
efree(property_name);
@@ -1626,7 +1627,7 @@ void zend_do_begin_accessor_declaration(znode *function_token, znode *modifiers,
16261627
/* Inherit property modifiers, allowing to override PPP. This check
16271628
* can be improved depending on just what exactly we want to allow
16281629
* (this will become important once we support abstract). */
1629-
property_flags = property_info->ai->flags;
1630+
property_flags = property_info->flags;
16301631
if ((Z_LVAL(modifiers->u.constant) & ZEND_ACC_PPP_MASK) != 0) {
16311632
property_flags &= ~ZEND_ACC_PPP_MASK;
16321633
}
@@ -4644,7 +4645,6 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
46444645
if (zend_hash_find(&ce->properties_info, prop_name, prop_name_length+1, (void**) &created_property_info) == SUCCESS) {
46454646
int j;
46464647
created_property_info->ai = ecalloc(1, sizeof(zend_accessor_info));
4647-
created_property_info->ai->flags = property_info->ai->flags;
46484648

46494649
for (j = 0; j < ZEND_ACCESSOR_COUNT; ++j) {
46504650
zend_do_trait_inherit_accessor(&created_property_info->ai->fn[j], property_info->ai->fn[j], ce, ce->traits[i], &overridden TSRMLS_CC);

Zend/zend_compile.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ typedef union _zend_function {
380380
} zend_function;
381381

382382
typedef struct _zend_accessor_info {
383-
zend_uint flags;
384383
zend_function *fn[4];
385384
} zend_accessor_info;
386385

ext/reflection/php_reflection.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -929,8 +929,8 @@ static void _property_string(string *str, zend_property_info *prop, char *prop_n
929929
{
930930
const char *class_name;
931931

932-
if(prop->ai) {
933-
_property_accessor_string(str, prop, indent);
932+
if (prop && prop->ai) {
933+
_property_accessor_string(str, prop, indent TSRMLS_CC);
934934
return;
935935
}
936936

@@ -984,7 +984,7 @@ static void _property_accessor_string(string *str, zend_property_info *prop, cha
984984
int i;
985985

986986
/* These are mutually exclusive */
987-
switch (ai->flags & ZEND_ACC_PPP_MASK) {
987+
switch (prop->flags & ZEND_ACC_PPP_MASK) {
988988
case ZEND_ACC_PUBLIC:
989989
string_printf(str, "public ");
990990
break;
@@ -995,7 +995,7 @@ static void _property_accessor_string(string *str, zend_property_info *prop, cha
995995
string_printf(str, "protected ");
996996
break;
997997
}
998-
if (ai->flags & ZEND_ACC_STATIC) {
998+
if (prop->flags & ZEND_ACC_STATIC) {
999999
string_printf(str, "static ");
10001000
}
10011001

ext/reflection/tests/ReflectionExtension_getClasses_basic.phpt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var_dump($ext->getClasses());
99
?>
1010
==DONE==
1111
--EXPECTF--
12-
array(14) {
12+
array(12) {
1313
["ReflectionException"]=>
1414
&object(ReflectionClass)#%d (1) {
1515
["name"]=>
@@ -45,11 +45,6 @@ array(14) {
4545
["name"]=>
4646
string(16) "ReflectionMethod"
4747
}
48-
["ReflectionMethodAccessor"]=>
49-
&object(ReflectionClass)#%d (1) {
50-
["name"]=>
51-
string(24) "ReflectionMethodAccessor"
52-
}
5348
["ReflectionClass"]=>
5449
&object(ReflectionClass)#%d (1) {
5550
["name"]=>
@@ -65,11 +60,6 @@ array(14) {
6560
["name"]=>
6661
string(18) "ReflectionProperty"
6762
}
68-
["ReflectionPropertyAccessor"]=>
69-
&object(ReflectionClass)#%d (1) {
70-
["name"]=>
71-
string(26) "ReflectionPropertyAccessor"
72-
}
7363
["ReflectionExtension"]=>
7464
&object(ReflectionClass)#%d (1) {
7565
["name"]=>

0 commit comments

Comments
 (0)