@@ -3558,7 +3558,7 @@ static void preload_shutdown(void)
35583558 if (EG (class_table )) {
35593559 ZEND_HASH_MAP_REVERSE_FOREACH_VAL (EG (class_table ), zv ) {
35603560 zend_class_entry * ce = Z_PTR_P (zv );
3561- if (ce -> type == ZEND_INTERNAL_CLASS ) {
3561+ if (ce -> type == ZEND_INTERNAL_CLASS && Z_TYPE_P ( zv ) != IS_ALIAS_PTR ) {
35623562 break ;
35633563 }
35643564 } ZEND_HASH_MAP_FOREACH_END_DEL ();
@@ -3646,7 +3646,15 @@ static void preload_move_user_classes(HashTable *src, HashTable *dst)
36463646 zend_hash_extend (dst , dst -> nNumUsed + src -> nNumUsed , 0 );
36473647 ZEND_HASH_MAP_FOREACH_BUCKET_FROM (src , p , EG (persistent_classes_count )) {
36483648 zend_class_entry * ce = Z_PTR (p -> val );
3649- ZEND_ASSERT (ce -> type == ZEND_USER_CLASS );
3649+
3650+ /* Possible with internal class aliases */
3651+ if (ce -> type == ZEND_INTERNAL_CLASS ) {
3652+ ZEND_ASSERT (Z_TYPE (p -> val ) == IS_ALIAS_PTR );
3653+ _zend_hash_append (dst , p -> key , & p -> val );
3654+ zend_hash_del_bucket (src , p );
3655+ continue ;
3656+ }
3657+
36503658 if (ce -> info .user .filename != filename ) {
36513659 filename = ce -> info .user .filename ;
36523660 if (filename ) {
@@ -3944,7 +3952,12 @@ static void preload_link(void)
39443952
39453953 ZEND_HASH_MAP_FOREACH_STR_KEY_VAL_FROM (EG (class_table ), key , zv , EG (persistent_classes_count )) {
39463954 ce = Z_PTR_P (zv );
3947- ZEND_ASSERT (ce -> type != ZEND_INTERNAL_CLASS );
3955+
3956+ /* Possible with internal class aliases */
3957+ if (ce -> type == ZEND_INTERNAL_CLASS ) {
3958+ ZEND_ASSERT (Z_TYPE_P (zv ) == IS_ALIAS_PTR );
3959+ continue ;
3960+ }
39483961
39493962 if (!(ce -> ce_flags & (ZEND_ACC_TOP_LEVEL |ZEND_ACC_ANON_CLASS ))
39503963 || (ce -> ce_flags & ZEND_ACC_LINKED )) {
@@ -4030,9 +4043,15 @@ static void preload_link(void)
40304043
40314044 ZEND_HASH_MAP_REVERSE_FOREACH_VAL (EG (class_table ), zv ) {
40324045 ce = Z_PTR_P (zv );
4046+
4047+ /* Possible with internal class aliases */
40334048 if (ce -> type == ZEND_INTERNAL_CLASS ) {
4034- break ;
4049+ if (Z_TYPE_P (zv ) != IS_ALIAS_PTR ) {
4050+ break ; /* can stop already */
4051+ }
4052+ continue ;
40354053 }
4054+
40364055 if ((ce -> ce_flags & ZEND_ACC_LINKED ) && !(ce -> ce_flags & ZEND_ACC_CONSTANTS_UPDATED )) {
40374056 if (!(ce -> ce_flags & ZEND_ACC_TRAIT )) { /* don't update traits */
40384057 CG (in_compilation ) = true; /* prevent autoloading */
@@ -4049,7 +4068,13 @@ static void preload_link(void)
40494068 ZEND_HASH_MAP_FOREACH_STR_KEY_VAL_FROM (
40504069 EG (class_table ), key , zv , EG (persistent_classes_count )) {
40514070 ce = Z_PTR_P (zv );
4052- ZEND_ASSERT (ce -> type != ZEND_INTERNAL_CLASS );
4071+
4072+ /* Possible with internal class aliases */
4073+ if (ce -> type == ZEND_INTERNAL_CLASS ) {
4074+ ZEND_ASSERT (Z_TYPE_P (zv ) == IS_ALIAS_PTR );
4075+ continue ;
4076+ }
4077+
40534078 if ((ce -> ce_flags & (ZEND_ACC_TOP_LEVEL |ZEND_ACC_ANON_CLASS ))
40544079 && !(ce -> ce_flags & ZEND_ACC_LINKED )) {
40554080 zend_string * lcname = zend_string_tolower (ce -> name );
0 commit comments