Skip to content

Commit 7d8b221

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

55 files changed

Lines changed: 95 additions & 1215 deletions

File tree

Some content is hidden

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

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
if (CG(compiler_options) & ZEND_COMPILE_WITH_FILE_CACHE) {
@@ -793,13 +790,6 @@ static bool zend_optimizer_ignore_class(zval *ce_zv, const zend_string *filename
793790
return false;
794791
}
795792
}
796-
// Ignore deprecated aliases so that they are fetched at runtime
797-
if (Z_TYPE_P(ce_zv) == IS_ALIAS_PTR) {
798-
zend_class_alias *alias = Z_CLASS_ALIAS_P(ce_zv);
799-
if (alias->alias_flags & ZEND_ACC_DEPRECATED) {
800-
return true;
801-
}
802-
}
803793
return ce->type == ZEND_USER_CLASS
804794
&& (!ce->info.user.filename || ce->info.user.filename != filename);
805795
}
@@ -836,14 +826,7 @@ zend_class_entry *zend_optimizer_get_class_entry(
836826
return Z_PTR_P(ce_or_alias);
837827
}
838828
ZEND_ASSERT(Z_TYPE_P(ce_or_alias) == IS_ALIAS_PTR);
839-
zend_class_alias *alias = Z_CLASS_ALIAS_P(ce_or_alias);
840-
if (alias->alias_flags & ZEND_ACC_DEPRECATED) {
841-
// Pretend that the class cannot be found so that it gets looked
842-
// up at runtime
843-
return NULL;
844-
}
845-
return NULL;
846-
// return Z_CLASS_ALIAS_P(ce_or_alias)->ce;
829+
return Z_CLASS_ALIAS_P(ce_or_alias)->ce;
847830
}
848831

849832
zval *ce_zv = zend_hash_find(CG(class_table), lcname);
@@ -852,8 +835,7 @@ zend_class_entry *zend_optimizer_get_class_entry(
852835
return Z_PTR_P(ce_zv);
853836
}
854837
ZEND_ASSERT(Z_TYPE_P(ce_zv) == IS_ALIAS_PTR);
855-
return NULL;
856-
// return Z_CLASS_ALIAS_P(ce_zv)->ce;
838+
return Z_CLASS_ALIAS_P(ce_zv)->ce;
857839
}
858840

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