Skip to content

Commit 9dd407c

Browse files
Revert attributes/name/etc.
Just switching to a zend_class_alias object should be easier
1 parent 31ecd01 commit 9dd407c

File tree

54 files changed

+117
-1216
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

+117
-1216
lines changed

Zend/Optimizer/zend_optimizer.c

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -776,9 +776,6 @@ static bool zend_optimizer_ignore_class(zval *ce_zv, zend_string *filename)
776776
{
777777
zend_class_entry *ce;
778778
Z_CE_FROM_ZVAL_P(ce, ce_zv);
779-
if (Z_TYPE_P(ce_zv) == IS_ALIAS_PTR) {
780-
return true;
781-
}
782779

783780
if (ce->ce_flags & ZEND_ACC_PRELOADED) {
784781
Bucket *ce_bucket = (Bucket*)((uintptr_t)ce_zv - XtOffsetOf(Bucket, val));
@@ -787,13 +784,6 @@ static bool zend_optimizer_ignore_class(zval *ce_zv, zend_string *filename)
787784
return false;
788785
}
789786
}
790-
// Ignore deprecated aliases so that they are fetched at runtime
791-
if (Z_TYPE_P(ce_zv) == IS_ALIAS_PTR) {
792-
zend_class_alias *alias = Z_CLASS_ALIAS_P(ce_zv);
793-
if (alias->alias_flags & ZEND_ACC_DEPRECATED) {
794-
return true;
795-
}
796-
}
797787
return ce->type == ZEND_USER_CLASS
798788
&& (!ce->info.user.filename || ce->info.user.filename != filename);
799789
}
@@ -827,14 +817,7 @@ zend_class_entry *zend_optimizer_get_class_entry(
827817
return Z_PTR_P(ce_or_alias);
828818
}
829819
ZEND_ASSERT(Z_TYPE_P(ce_or_alias) == IS_ALIAS_PTR);
830-
zend_class_alias *alias = Z_CLASS_ALIAS_P(ce_or_alias);
831-
if (alias->alias_flags & ZEND_ACC_DEPRECATED) {
832-
// Pretend that the class cannot be found so that it gets looked
833-
// up at runtime
834-
return NULL;
835-
}
836-
return NULL;
837-
// return Z_CLASS_ALIAS_P(ce_or_alias)->ce;
820+
return Z_CLASS_ALIAS_P(ce_or_alias)->ce;
838821
}
839822

840823
zval *ce_zv = zend_hash_find(CG(class_table), lcname);
@@ -843,8 +826,7 @@ zend_class_entry *zend_optimizer_get_class_entry(
843826
return Z_PTR_P(ce_zv);
844827
}
845828
ZEND_ASSERT(Z_TYPE_P(ce_zv) == IS_ALIAS_PTR);
846-
return NULL;
847-
// return Z_CLASS_ALIAS_P(ce_zv)->ce;
829+
return Z_CLASS_ALIAS_P(ce_zv)->ce;
848830
}
849831

850832
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)