3434#include "zend_enum.h"
3535#include "zend_object_handlers.h"
3636#include "zend_observer.h"
37+ #include "zend_class_alias.h"
3738
3839#include <stdarg.h>
3940
@@ -2543,7 +2544,9 @@ ZEND_API void zend_collect_module_handlers(void) /* {{{ */
25432544 } ZEND_HASH_FOREACH_END ();
25442545
25452546 /* Collect internal classes with static members */
2546- ZEND_HASH_MAP_FOREACH_PTR (CG (class_table ), ce ) {
2547+ zval * ce_or_alias ;
2548+ ZEND_HASH_MAP_FOREACH_VAL (CG (class_table ), ce_or_alias ) {
2549+ Z_CE_FROM_ZVAL_P (ce , ce_or_alias );
25472550 if (ce -> type == ZEND_INTERNAL_CLASS &&
25482551 ce -> default_static_members_count > 0 ) {
25492552 class_count ++ ;
@@ -2557,7 +2560,8 @@ ZEND_API void zend_collect_module_handlers(void) /* {{{ */
25572560 class_cleanup_handlers [class_count ] = NULL ;
25582561
25592562 if (class_count ) {
2560- ZEND_HASH_MAP_FOREACH_PTR (CG (class_table ), ce ) {
2563+ ZEND_HASH_MAP_FOREACH_VAL (CG (class_table ), ce_or_alias ) {
2564+ Z_CE_FROM_ZVAL_P (ce , ce_or_alias );
25612565 if (ce -> type == ZEND_INTERNAL_CLASS &&
25622566 ce -> default_static_members_count > 0 ) {
25632567 class_cleanup_handlers [-- class_count ] = ce ;
@@ -3282,8 +3286,9 @@ static void clean_module_classes(int module_number) /* {{{ */
32823286{
32833287 /* Child classes may reuse structures from parent classes, so destroy in reverse order. */
32843288 Bucket * bucket ;
3289+ zend_class_entry * ce ;
32853290 ZEND_HASH_REVERSE_FOREACH_BUCKET (EG (class_table ), bucket ) {
3286- zend_class_entry * ce = Z_CE ( bucket -> val );
3291+ Z_CE_FROM_ZVAL ( ce , bucket -> val );
32873292 if (ce -> type == ZEND_INTERNAL_CLASS && ce -> info .internal .module -> module_number == module_number ) {
32883293 zend_hash_del_bucket (EG (class_table ), bucket );
32893294 }
@@ -3596,7 +3601,9 @@ ZEND_API zend_result zend_register_class_alias_ex(const char *name, size_t name_
35963601 * Instead of having to deal with differentiating between class types and lifetimes,
35973602 * we simply don't increase the refcount of a class entry for aliases.
35983603 */
3599- ZVAL_ALIAS_PTR (& zv , ce );
3604+ zend_class_alias * alias = zend_class_alias_init (ce );
3605+
3606+ ZVAL_ALIAS_PTR (& zv , alias );
36003607
36013608 ret = zend_hash_add (CG (class_table ), lcname , & zv );
36023609 zend_string_release_ex (lcname , 0 );
@@ -3723,11 +3730,12 @@ ZEND_API zend_result zend_disable_class(const char *class_name, size_t class_nam
37233730
37243731 key = zend_string_alloc (class_name_length , 0 );
37253732 zend_str_tolower_copy (ZSTR_VAL (key ), class_name , class_name_length );
3726- disabled_class = zend_hash_find_ptr (CG (class_table ), key );
3733+ zval * disabled_class_or_alias = zend_hash_find (CG (class_table ), key );
37273734 zend_string_release_ex (key , 0 );
3728- if (!disabled_class ) {
3735+ if (!disabled_class_or_alias ) {
37293736 return FAILURE ;
37303737 }
3738+ Z_CE_FROM_ZVAL_P (disabled_class , disabled_class_or_alias );
37313739
37323740 /* Will be reset by INIT_CLASS_ENTRY. */
37333741 free (disabled_class -> interfaces );
0 commit comments