|
30 | 30 | #include "zend_call_graph.h"
|
31 | 31 | #include "zend_inference.h"
|
32 | 32 | #include "zend_dump.h"
|
| 33 | +#include "zend_class_alias.h" |
33 | 34 | #include "php.h"
|
34 | 35 |
|
35 | 36 | #ifndef ZEND_OPTIMIZER_MAX_REGISTERED_PASSES
|
@@ -773,7 +774,8 @@ void zend_optimizer_shift_jump(zend_op_array *op_array, zend_op *opline, uint32_
|
773 | 774 |
|
774 | 775 | static bool zend_optimizer_ignore_class(zval *ce_zv, zend_string *filename)
|
775 | 776 | {
|
776 |
| - zend_class_entry *ce = Z_PTR_P(ce_zv); |
| 777 | + zend_class_entry *ce; |
| 778 | + Z_CE_FROM_ZVAL_P(ce, ce_zv); |
777 | 779 |
|
778 | 780 | if (ce->ce_flags & ZEND_ACC_PRELOADED) {
|
779 | 781 | Bucket *ce_bucket = (Bucket*)((uintptr_t)ce_zv - XtOffsetOf(Bucket, val));
|
@@ -809,14 +811,22 @@ static bool zend_optimizer_ignore_function(zval *fbc_zv, zend_string *filename)
|
809 | 811 |
|
810 | 812 | zend_class_entry *zend_optimizer_get_class_entry(
|
811 | 813 | const zend_script *script, const zend_op_array *op_array, zend_string *lcname) {
|
812 |
| - zend_class_entry *ce = script ? zend_hash_find_ptr(&script->class_table, lcname) : NULL; |
813 |
| - if (ce) { |
814 |
| - return ce; |
| 814 | + zval *ce_or_alias = script ? zend_hash_find(&script->class_table, lcname) : NULL; |
| 815 | + if (ce_or_alias) { |
| 816 | + if (EXPECTED(Z_TYPE_P(ce_or_alias) == IS_PTR)) { |
| 817 | + return Z_PTR_P(ce_or_alias); |
| 818 | + } |
| 819 | + ZEND_ASSERT(Z_TYPE_P(ce_or_alias) == IS_ALIAS_PTR); |
| 820 | + return Z_CLASS_ALIAS_P(ce_or_alias)->ce; |
815 | 821 | }
|
816 | 822 |
|
817 | 823 | zval *ce_zv = zend_hash_find(CG(class_table), lcname);
|
818 | 824 | if (ce_zv && !zend_optimizer_ignore_class(ce_zv, op_array ? op_array->filename : NULL)) {
|
819 |
| - return Z_PTR_P(ce_zv); |
| 825 | + if (EXPECTED(Z_TYPE_P(ce_zv) == IS_PTR)) { |
| 826 | + return Z_PTR_P(ce_zv); |
| 827 | + } |
| 828 | + ZEND_ASSERT(Z_TYPE_P(ce_zv) == IS_ALIAS_PTR); |
| 829 | + return Z_CLASS_ALIAS_P(ce_zv)->ce; |
820 | 830 | }
|
821 | 831 |
|
822 | 832 | if (op_array && op_array->scope && zend_string_equals_ci(op_array->scope->name, lcname)) {
|
|
0 commit comments