diff options
Diffstat (limited to 'Zend/zend.c')
-rw-r--r-- | Zend/zend.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Zend/zend.c b/Zend/zend.c index 3143217b8d..3619a7808d 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -950,6 +950,28 @@ void zend_register_standard_ini_entries(void) /* {{{ */ } /* }}} */ +static void zend_resolve_property_types(void) /* {{{ */ +{ + zend_class_entry *ce; + zend_property_info *prop_info; + + ZEND_HASH_FOREACH_PTR(CG(class_table), ce) { + if (UNEXPECTED(ce->type == ZEND_INTERNAL_CLASS && ZEND_CLASS_HAS_TYPE_HINTS(ce))) { + ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) { + if (ZEND_TYPE_IS_NAME(prop_info->type)) { + zend_string *type_name = zend_string_tolower(ZEND_TYPE_NAME(prop_info->type)); + zend_class_entry *prop_ce = zend_hash_find_ptr(CG(class_table), type_name); + + ZEND_ASSERT(prop_ce && prop_ce->type == ZEND_INTERNAL_CLASS); + prop_info->type = ZEND_TYPE_ENCODE_CE(prop_ce, ZEND_TYPE_ALLOW_NULL(prop_info->type)); + zend_string_release(type_name); + } + } ZEND_HASH_FOREACH_END(); + } + } ZEND_HASH_FOREACH_END(); +} +/* }}} */ + /* Unlink the global (r/o) copies of the class, function and constant tables, * and use a fresh r/w copy for the startup thread */ @@ -971,6 +993,8 @@ int zend_post_startup(void) /* {{{ */ } } + zend_resolve_property_types(); + #ifdef ZTS *GLOBAL_FUNCTION_TABLE = *compiler_globals->function_table; *GLOBAL_CLASS_TABLE = *compiler_globals->class_table; |