Skip to content

Commit da6a7d6

Browse files
Revert attributes/name/etc.
Just switching to a zend_class_alias object should be easier
1 parent fee66bf commit da6a7d6

File tree

54 files changed

+91
-1211
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+91
-1211
lines changed

Zend/Optimizer/zend_optimizer.c

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -779,9 +779,6 @@ static bool zend_optimizer_ignore_class(zval *ce_zv, const zend_string *filename
779779
{
780780
const zend_class_entry *ce;
781781
Z_CE_FROM_ZVAL_P(ce, ce_zv);
782-
if (Z_TYPE_P(ce_zv) == IS_ALIAS_PTR) {
783-
return true;
784-
}
785782

786783
if (ce->ce_flags & ZEND_ACC_PRELOADED) {
787784
const Bucket *ce_bucket = (const Bucket*)((uintptr_t)ce_zv - XtOffsetOf(Bucket, val));
@@ -790,13 +787,6 @@ static bool zend_optimizer_ignore_class(zval *ce_zv, const zend_string *filename
790787
return false;
791788
}
792789
}
793-
// Ignore deprecated aliases so that they are fetched at runtime
794-
if (Z_TYPE_P(ce_zv) == IS_ALIAS_PTR) {
795-
zend_class_alias *alias = Z_CLASS_ALIAS_P(ce_zv);
796-
if (alias->alias_flags & ZEND_ACC_DEPRECATED) {
797-
return true;
798-
}
799-
}
800790
return ce->type == ZEND_USER_CLASS
801791
&& (!ce->info.user.filename || ce->info.user.filename != filename);
802792
}
@@ -830,14 +820,7 @@ zend_class_entry *zend_optimizer_get_class_entry(
830820
return Z_PTR_P(ce_or_alias);
831821
}
832822
ZEND_ASSERT(Z_TYPE_P(ce_or_alias) == IS_ALIAS_PTR);
833-
zend_class_alias *alias = Z_CLASS_ALIAS_P(ce_or_alias);
834-
if (alias->alias_flags & ZEND_ACC_DEPRECATED) {
835-
// Pretend that the class cannot be found so that it gets looked
836-
// up at runtime
837-
return NULL;
838-
}
839-
return NULL;
840-
// return Z_CLASS_ALIAS_P(ce_or_alias)->ce;
823+
return Z_CLASS_ALIAS_P(ce_or_alias)->ce;
841824
}
842825

843826
zval *ce_zv = zend_hash_find(CG(class_table), lcname);
@@ -846,8 +829,7 @@ zend_class_entry *zend_optimizer_get_class_entry(
846829
return Z_PTR_P(ce_zv);
847830
}
848831
ZEND_ASSERT(Z_TYPE_P(ce_zv) == IS_ALIAS_PTR);
849-
return NULL;
850-
// return Z_CLASS_ALIAS_P(ce_zv)->ce;
832+
return Z_CLASS_ALIAS_P(ce_zv)->ce;
851833
}
852834

853835
if (op_array && op_array->scope && zend_string_equals_ci(op_array->scope->name, lcname)) {

Zend/tests/attributes/034_target_values.phpt

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,24 @@ showFlag("TARGET_PROPERTY", Attribute::TARGET_PROPERTY);
1616
showFlag("TARGET_CLASS_CONSTANT", Attribute::TARGET_CLASS_CONSTANT);
1717
showFlag("TARGET_PARAMETER", Attribute::TARGET_PARAMETER);
1818
showFlag("TARGET_CONSTANT", Attribute::TARGET_CONSTANT);
19-
showFlag("TARGET_CLASS_ALIAS", Attribute::TARGET_CLASS_ALIAS);
2019
showFlag("IS_REPEATABLE", Attribute::IS_REPEATABLE);
2120

2221
$all = Attribute::TARGET_CLASS | Attribute::TARGET_FUNCTION
2322
| Attribute::TARGET_METHOD | Attribute::TARGET_PROPERTY
2423
| Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PARAMETER
25-
| Attribute::TARGET_CONSTANT | Attribute::TARGET_CLASS_ALIAS;
24+
| Attribute::TARGET_CONSTANT;
2625
var_dump($all, Attribute::TARGET_ALL, $all === Attribute::TARGET_ALL);
2726

2827
?>
2928
--EXPECT--
30-
Attribute::TARGET_CLASS = 1 (255 & 1 === 1)
31-
Attribute::TARGET_FUNCTION = 2 (255 & 2 === 2)
32-
Attribute::TARGET_METHOD = 4 (255 & 4 === 4)
33-
Attribute::TARGET_PROPERTY = 8 (255 & 8 === 8)
34-
Attribute::TARGET_CLASS_CONSTANT = 16 (255 & 16 === 16)
35-
Attribute::TARGET_PARAMETER = 32 (255 & 32 === 32)
36-
Attribute::TARGET_CONSTANT = 64 (255 & 64 === 64)
37-
Attribute::TARGET_CLASS_ALIAS = 128 (255 & 128 === 128)
38-
Attribute::IS_REPEATABLE = 256 (255 & 256 === 0)
39-
int(255)
40-
int(255)
29+
Attribute::TARGET_CLASS = 1 (127 & 1 === 1)
30+
Attribute::TARGET_FUNCTION = 2 (127 & 2 === 2)
31+
Attribute::TARGET_METHOD = 4 (127 & 4 === 4)
32+
Attribute::TARGET_PROPERTY = 8 (127 & 8 === 8)
33+
Attribute::TARGET_CLASS_CONSTANT = 16 (127 & 16 === 16)
34+
Attribute::TARGET_PARAMETER = 32 (127 & 32 === 32)
35+
Attribute::TARGET_CONSTANT = 64 (127 & 64 === 64)
36+
Attribute::IS_REPEATABLE = 128 (127 & 128 === 0)
37+
int(127)
38+
int(127)
4139
bool(true)

Zend/tests/attributes/class_alias/attributes_array_contains_non-object.phpt

Lines changed: 0 additions & 17 deletions
This file was deleted.

Zend/tests/attributes/class_alias/attributes_array_non-object.phpt

Lines changed: 0 additions & 17 deletions
This file was deleted.

Zend/tests/attributes/class_alias/attributes_dict.phpt

Lines changed: 0 additions & 21 deletions
This file was deleted.

Zend/tests/attributes/class_alias/attributes_nonarray.phpt

Lines changed: 0 additions & 14 deletions
This file was deleted.

Zend/tests/attributes/class_alias/attributes_valid.phpt

Lines changed: 0 additions & 12 deletions
This file was deleted.

Zend/tests/attributes/class_alias/name_invalid.phpt

Lines changed: 0 additions & 11 deletions
This file was deleted.

Zend/tests/attributes/class_alias/name_nonstring.phpt

Lines changed: 0 additions & 11 deletions
This file was deleted.

Zend/tests/attributes/class_alias/name_required.phpt

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)