com php-src: Fixed ZTS compatibility: Zend/zend.c Zend/zend_e xecute_API.c
| From: | Bob Weinand | Date: | Thu, 26 May 2016 12:13:06 +0000 |
| Subject: | com php-src: Fixed ZTS compatibility: Zend/zend.c Zend/zend_e xecute_API.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95507@lists.php.net to get a copy of this message | ||
Commit: 865686ff459b366fe1c82b6588bce50f3478121a
Author: Dmitry Stogov <dmitry@zend.com> Thu, 26 May 2016 15:13:06 +0300
Parents: 26bf822a3a8f61752423cbbd0cdbf7d2398d6bb6
Branches: typed_ref_properties
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=865686ff459b366fe1c82b6588bce50f3478121a
Log:
Fixed ZTS compatibility
Changed paths:
M Zend/zend.c
M Zend/zend_execute_API.c
Diff:
diff --git a/Zend/zend.c b/Zend/zend.c
index c4b91ce..77f054d 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -769,6 +769,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)
+ && UNEXPECTED(ZEND_CLASS_HAS_TYPE_HINTS(ce))) {
+
+ ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
+ if (prop_info->type == IS_OBJECT && prop_info->type_name) {
+ zend_class_entry *prop_ce =
+ zend_hash_find(CG(class_table), prop_info->type_name);
+
+ assert(prop_ce && prop_ce->type == ZEND_INTERNAL_CLASS);
+ prop_info->type_ce = prop_ce;
+ }
+ }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
*/
@@ -780,6 +802,8 @@ void zend_post_startup(void) /* {{{ */
zend_compiler_globals *compiler_globals = ts_resource(compiler_globals_id);
zend_executor_globals *executor_globals = ts_resource(executor_globals_id);
+ zend_resolve_property_types();
+
*GLOBAL_FUNCTION_TABLE = *compiler_globals->function_table;
*GLOBAL_CLASS_TABLE = *compiler_globals->class_table;
*GLOBAL_CONSTANTS_TABLE = *executor_globals->zend_constants;
@@ -804,6 +828,7 @@ void zend_post_startup(void) /* {{{ */
global_persistent_list = &EG(persistent_list);
zend_copy_ini_directives();
#else
+ zend_resolve_property_types();
virtual_cwd_deactivate();
#endif
}
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index a9a82a6..dba10e3 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -114,25 +114,6 @@ ZEND_API int clean_non_persistent_function_full(zval *zv) /* {{{ */
}
/* }}} */
-static int clean_non_persistent_type_info(zval *zv) /* {{{ */
-{
- zend_class_entry *ce = Z_PTR_P(zv);
-
- if (UNEXPECTED(ce->type == ZEND_INTERNAL_CLASS)) {
- if (ZEND_CLASS_HAS_TYPE_HINTS(ce)) {
- zend_property_info *prop_info;
- ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
- if (prop_info->type_ce->type == ZEND_USER_CLASS) {
- prop_info->type_ce = NULL;
- }
- } ZEND_HASH_FOREACH_END();
- }
- return ZEND_HASH_APPLY_KEEP;
- }
-
- return ZEND_HASH_APPLY_STOP;
-} /* }}} */
-
static int clean_non_persistent_class(zval *zv) /* {{{ */
{
zend_class_entry *ce = Z_PTR_P(zv);
@@ -378,9 +359,6 @@ void shutdown_executor(void) /* {{{ */
zend_vm_stack_destroy();
- /* remove non persistent type info from internal classes */
- zend_hash_apply(EG(class_table), clean_non_persistent_type_info);
-
/* Destroy all op arrays */
if (EG(full_tables_cleanup)) {
zend_hash_reverse_apply(EG(function_table), clean_non_persistent_function_full);