]> granicus.if.org Git - php/commitdiff
Fixed apply_func_t (they should be broken before)
authorXinchen Hui <laruence@php.net>
Sun, 25 May 2014 10:32:35 +0000 (18:32 +0800)
committerXinchen Hui <laruence@php.net>
Sun, 25 May 2014 10:32:35 +0000 (18:32 +0800)
Zend/zend_API.c
Zend/zend_execute.c
Zend/zend_ini.c
Zend/zend_opcode.c
sapi/cgi/cgi_main.c
sapi/cli/php_cli.c

index 22ba10b02935a2be6ae31230db454b70ff8cabab..a52abe3544cd3cacfdd7fcda5dc7e50acdb9db19 100644 (file)
@@ -2583,8 +2583,16 @@ int module_registry_unload_temp(const zend_module_entry *module TSRMLS_DC) /* {{
 }
 /* }}} */
 
-static int exec_done_cb(zend_module_entry *module TSRMLS_DC) /* {{{ */
+static int module_registry_unload_temp_wrapper(zval *el TSRMLS_DC) /* {{{ */
 {
+       zend_module_entry *module = (zend_module_entry *)Z_PTR_P(el);
+       return module_registry_unload_temp((const zend_module_entry *)module TSRMLS_CC);
+}
+/* }}} */
+
+static int exec_done_cb(zval *el TSRMLS_DC) /* {{{ */
+{
+       zend_module_entry *module = (zend_module_entry *)Z_PTR_P(el);
        if (module->post_deactivate_func) {
                module->post_deactivate_func();
        }
@@ -2595,8 +2603,8 @@ static int exec_done_cb(zend_module_entry *module TSRMLS_DC) /* {{{ */
 ZEND_API void zend_post_deactivate_modules(TSRMLS_D) /* {{{ */
 {
        if (EG(full_tables_cleanup)) {
-               zend_hash_apply(&module_registry, (apply_func_t) exec_done_cb TSRMLS_CC);
-               zend_hash_reverse_apply(&module_registry, (apply_func_t) module_registry_unload_temp TSRMLS_CC);
+               zend_hash_apply(&module_registry, exec_done_cb TSRMLS_CC);
+               zend_hash_reverse_apply(&module_registry, module_registry_unload_temp_wrapper TSRMLS_CC);
        } else {
                zend_module_entry **p = module_post_deactivate_handlers;
 
index 1979f59b09b959900356d42df1f6aad2c373554d..fa0e4634f30a7e5ea7121618d18ec84147e0ccf8 100644 (file)
@@ -1452,26 +1452,28 @@ static inline zend_brk_cont_element* zend_brk_cont(int nest_levels, int array_of
 
 #if ZEND_INTENSIVE_DEBUGGING
 
-#define CHECK_SYMBOL_TABLES()                                                                                                          \
-       zend_hash_apply(&EG(symbol_table), (apply_func_t) zend_check_symbol TSRMLS_CC); \
-       if (&EG(symbol_table)!=EG(active_symbol_table)) {                                                               \
-               zend_hash_apply(EG(active_symbol_table), (apply_func_t) zend_check_symbol TSRMLS_CC);   \
+#define CHECK_SYMBOL_TABLES()                                                                                                  \
+       zend_hash_apply(&EG(symbol_table), zend_check_symbol TSRMLS_CC);                        \
+       if (&EG(symbol_table)!=EG(active_symbol_table)) {                                                       \
+               zend_hash_apply(EG(active_symbol_table), zend_check_symbol TSRMLS_CC);  \
        }
 
-static int zend_check_symbol(zval **pz TSRMLS_DC)
+static int zend_check_symbol(zval *pz TSRMLS_DC)
 {
-       if (Z_TYPE_PP(pz) > 9) {
+       if (Z_TYPE_P(pz) == IS_INDIRECT) {
+               pz = Z_INDIRECT_P(pz);
+       }
+       if (Z_TYPE_P(pz) > 10) {
                fprintf(stderr, "Warning!  %x has invalid type!\n", *pz);
 /* See http://support.microsoft.com/kb/190351 */
 #ifdef PHP_WIN32
                fflush(stderr);
 #endif
-       } else if (Z_TYPE_PP(pz) == IS_ARRAY) {
-               zend_hash_apply(Z_ARRVAL_PP(pz), (apply_func_t) zend_check_symbol TSRMLS_CC);
-       } else if (Z_TYPE_PP(pz) == IS_OBJECT) {
-
+       } else if (Z_TYPE_P(pz) == IS_ARRAY) {
+               zend_hash_apply(Z_ARRVAL_P(pz), zend_check_symbol TSRMLS_CC);
+       } else if (Z_TYPE_P(pz) == IS_OBJECT) {
                /* OBJ-TBI - doesn't support new object model! */
-               zend_hash_apply(Z_OBJPROP_PP(pz), (apply_func_t) zend_check_symbol TSRMLS_CC);
+               zend_hash_apply(Z_OBJPROP_P(pz), zend_check_symbol TSRMLS_CC);
        }
 
        return 0;
index 883a6bf84b5b156288179f5e4795613dcba04064..ca4e4d7863404ff7a6e1ef3c96699270b85eb228 100644 (file)
@@ -76,9 +76,10 @@ static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS
 }
 /* }}} */
 
-static int zend_restore_ini_entry_wrapper(zend_ini_entry **ini_entry TSRMLS_DC) /* {{{ */
+static int zend_restore_ini_entry_wrapper(zval *el TSRMLS_DC) /* {{{ */
 {
-       zend_restore_ini_entry_cb(*ini_entry, ZEND_INI_STAGE_DEACTIVATE TSRMLS_CC);
+       zend_ini_entry *ini_entry = (zend_ini_entry *)Z_PTR_P(el);
+       zend_restore_ini_entry_cb(ini_entry, ZEND_INI_STAGE_DEACTIVATE TSRMLS_CC);
        return 1;
 }
 /* }}} */
@@ -123,7 +124,7 @@ ZEND_API int zend_ini_global_shutdown(TSRMLS_D) /* {{{ */
 ZEND_API int zend_ini_deactivate(TSRMLS_D) /* {{{ */
 {
        if (EG(modified_ini_directives)) {
-               zend_hash_apply(EG(modified_ini_directives), (apply_func_t) zend_restore_ini_entry_wrapper TSRMLS_CC);
+               zend_hash_apply(EG(modified_ini_directives), zend_restore_ini_entry_wrapper TSRMLS_CC);
                zend_hash_destroy(EG(modified_ini_directives));
                FREE_HASHTABLE(EG(modified_ini_directives));
                EG(modified_ini_directives) = NULL;
index d1c4e681e14dbcd70f6eab63c29aebeec830f617..c0fc94a120958b5ba62e14301c91b33c0649ef5b 100644 (file)
@@ -715,10 +715,15 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
        return 0;
 }
 
+int pass_two_wrapper(zval *el TSRMLS_DC)
+{
+       return pass_two((zend_op_array*)Z_PTR_P(el));
+}
+
 int print_class(zend_class_entry *class_entry TSRMLS_DC)
 {
        printf("Class %s:\n", class_entry->name->val);
-       zend_hash_apply(&class_entry->function_table, (apply_func_t) pass_two TSRMLS_CC);
+       zend_hash_apply(&class_entry->function_table, pass_two_wrapper TSRMLS_CC);
        printf("End of class %s.\n\n", class_entry->name->val);
        return 0;
 }
index cb76caaa93a05fcb741eb5ea403ec7313565d50b..16f11fd40c34005afc23542bf4a08773e6aaa238 100644 (file)
@@ -241,7 +241,7 @@ static void print_modules(TSRMLS_D)
 //???  zend_hash_copy(&sorted_registry, &module_registry, NULL, &tmp, sizeof(zend_module_entry));
        zend_hash_copy(&sorted_registry, &module_registry, NULL);
        zend_hash_sort(&sorted_registry, zend_qsort, module_name_cmp, 0 TSRMLS_CC);
-       zend_hash_apply(&sorted_registry, (apply_func_t) print_module_info TSRMLS_CC);
+       zend_hash_apply(&sorted_registry, print_module_info TSRMLS_CC);
        zend_hash_destroy(&sorted_registry);
 }
 
index 2156cb14fcaf9d5a8178cc2e91de27d488288816..d353b00a06eaf0b16e5792901ee05fa2114ab656 100644 (file)
@@ -198,7 +198,7 @@ static void print_modules(TSRMLS_D) /* {{{ */
        zend_hash_init(&sorted_registry, 50, NULL, NULL, 0);
        zend_hash_copy(&sorted_registry, &module_registry, NULL);
        zend_hash_sort(&sorted_registry, zend_qsort, module_name_cmp, 0 TSRMLS_CC);
-       zend_hash_apply(&sorted_registry, (apply_func_t) print_module_info TSRMLS_CC);
+       zend_hash_apply(&sorted_registry, print_module_info TSRMLS_CC);
        zend_hash_destroy(&sorted_registry);
 }
 /* }}} */