From 987dee9ca1be517f4be02d9c8f721d569596dc5a Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 25 Mar 2013 12:21:58 +0400 Subject: [PATCH] Fixed PHP-5.2 ZTS compatibility --- ext/opcache/Optimizer/block_pass.c | 4 ++++ ext/opcache/Optimizer/pass1_5.c | 4 ++++ ext/opcache/ZendAccelerator.c | 20 ++++++++++++++++++++ ext/opcache/zend_accelerator_util_funcs.c | 2 +- 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c index d4299c8add..7fd986ca6d 100644 --- a/ext/opcache/Optimizer/block_pass.c +++ b/ext/opcache/Optimizer/block_pass.c @@ -972,7 +972,11 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, zval result; if (unary_op) { +#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO + unary_op(&result, &ZEND_OP1_LITERAL(opline)); +#else unary_op(&result, &ZEND_OP1_LITERAL(opline) TSRMLS_CC); +#endif literal_dtor(&ZEND_OP1_LITERAL(opline)); } else { /* BOOL */ diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index 8938e148ce..dc9e7319a9 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -203,7 +203,11 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { er = EG(error_reporting); EG(error_reporting) = 0; +#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO + if (unary_op(&result, &ZEND_OP1_LITERAL(opline)) != SUCCESS) { +#else if (unary_op(&result, &ZEND_OP1_LITERAL(opline) TSRMLS_CC) != SUCCESS) { +#endif EG(error_reporting) = er; break; } diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 64c5aa8f14..e634c130da 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -1204,10 +1204,18 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han } else { *op_array_p = NULL; if (type == ZEND_REQUIRE) { +#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename); +#else zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC); +#endif zend_bailout(); } else { +#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename); +#else zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename TSRMLS_CC); +#endif } return NULL; } @@ -1422,10 +1430,18 @@ static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int zend_stream_open(file_handle->filename, file_handle TSRMLS_CC) == FAILURE) { #endif if (type == ZEND_REQUIRE) { +#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename); +#else zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC); +#endif zend_bailout(); } else { +#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename); +#else zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename TSRMLS_CC); +#endif } return NULL; } @@ -1542,7 +1558,11 @@ static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int zend_hash_quick_add(&EG(included_files), persistent_script->full_path, persistent_script->full_path_len + 1, persistent_script->hash_value, &dummy, sizeof(void *), NULL); } } +#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO + zend_file_handle_dtor(file_handle); +#else zend_file_handle_dtor(file_handle TSRMLS_CC); +#endif from_shared_memory = 1; } diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index 7d5028c4c1..75b1561713 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -857,7 +857,7 @@ static void zend_do_delayed_early_binding(zend_op_array *op_array, zend_uint ear } opline_num = op_array->opcodes[opline_num].result.u.opline_num; } - zend_restore_compiled_filename(orig_compiled_filename); + zend_restore_compiled_filename(orig_compiled_filename TSRMLS_CC); CG(in_compilation) = orig_in_compilation; } } -- 2.40.0