Skip to content

Commit 1fea887

Browse files
committed
Set PROPERTY_TYPES_RESOLVED flag for internal classes
Also make sure that the resolution happens before preloading runs.
1 parent 0904115 commit 1fea887

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Zend/zend.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,11 @@ static void zend_resolve_property_types(void) /* {{{ */
956956
zend_property_info *prop_info;
957957

958958
ZEND_HASH_FOREACH_PTR(CG(class_table), ce) {
959-
if (UNEXPECTED(ce->type == ZEND_INTERNAL_CLASS && ZEND_CLASS_HAS_TYPE_HINTS(ce))) {
959+
if (ce->type != ZEND_INTERNAL_CLASS) {
960+
continue;
961+
}
962+
963+
if (UNEXPECTED(ZEND_CLASS_HAS_TYPE_HINTS(ce))) {
960964
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
961965
if (ZEND_TYPE_IS_NAME(prop_info->type)) {
962966
zend_string *type_name = ZEND_TYPE_NAME(prop_info->type);
@@ -970,6 +974,7 @@ static void zend_resolve_property_types(void) /* {{{ */
970974
}
971975
} ZEND_HASH_FOREACH_END();
972976
}
977+
ce->ce_flags |= ZEND_ACC_PROPERTY_TYPES_RESOLVED;
973978
} ZEND_HASH_FOREACH_END();
974979
}
975980
/* }}} */
@@ -986,6 +991,8 @@ int zend_post_startup(void) /* {{{ */
986991
zend_executor_globals *executor_globals = ts_resource(executor_globals_id);
987992
#endif
988993

994+
zend_resolve_property_types();
995+
989996
if (zend_post_startup_cb) {
990997
int (*cb)(void) = zend_post_startup_cb;
991998

@@ -995,8 +1002,6 @@ int zend_post_startup(void) /* {{{ */
9951002
}
9961003
}
9971004

998-
zend_resolve_property_types();
999-
10001005
#ifdef ZTS
10011006
*GLOBAL_FUNCTION_TABLE = *compiler_globals->function_table;
10021007
*GLOBAL_CLASS_TABLE = *compiler_globals->class_table;

0 commit comments

Comments
 (0)