Skip to content

Commit 987dee9

Browse files
committed
Fixed PHP-5.2 ZTS compatibility
1 parent a3316ff commit 987dee9

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

ext/opcache/Optimizer/block_pass.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,11 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array,
972972
zval result;
973973

974974
if (unary_op) {
975+
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
976+
unary_op(&result, &ZEND_OP1_LITERAL(opline));
977+
#else
975978
unary_op(&result, &ZEND_OP1_LITERAL(opline) TSRMLS_CC);
979+
#endif
976980
literal_dtor(&ZEND_OP1_LITERAL(opline));
977981
} else {
978982
/* BOOL */

ext/opcache/Optimizer/pass1_5.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,11 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
203203

204204
er = EG(error_reporting);
205205
EG(error_reporting) = 0;
206+
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
207+
if (unary_op(&result, &ZEND_OP1_LITERAL(opline)) != SUCCESS) {
208+
#else
206209
if (unary_op(&result, &ZEND_OP1_LITERAL(opline) TSRMLS_CC) != SUCCESS) {
210+
#endif
207211
EG(error_reporting) = er;
208212
break;
209213
}

ext/opcache/ZendAccelerator.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,10 +1204,18 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han
12041204
} else {
12051205
*op_array_p = NULL;
12061206
if (type == ZEND_REQUIRE) {
1207+
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
1208+
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename);
1209+
#else
12071210
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC);
1211+
#endif
12081212
zend_bailout();
12091213
} else {
1214+
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
1215+
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename);
1216+
#else
12101217
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename TSRMLS_CC);
1218+
#endif
12111219
}
12121220
return NULL;
12131221
}
@@ -1422,10 +1430,18 @@ static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int
14221430
zend_stream_open(file_handle->filename, file_handle TSRMLS_CC) == FAILURE) {
14231431
#endif
14241432
if (type == ZEND_REQUIRE) {
1433+
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
1434+
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename);
1435+
#else
14251436
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename TSRMLS_CC);
1437+
#endif
14261438
zend_bailout();
14271439
} else {
1440+
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
1441+
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename);
1442+
#else
14281443
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename TSRMLS_CC);
1444+
#endif
14291445
}
14301446
return NULL;
14311447
}
@@ -1542,7 +1558,11 @@ static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int
15421558
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);
15431559
}
15441560
}
1561+
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
1562+
zend_file_handle_dtor(file_handle);
1563+
#else
15451564
zend_file_handle_dtor(file_handle TSRMLS_CC);
1565+
#endif
15461566
from_shared_memory = 1;
15471567
}
15481568

ext/opcache/zend_accelerator_util_funcs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ static void zend_do_delayed_early_binding(zend_op_array *op_array, zend_uint ear
857857
}
858858
opline_num = op_array->opcodes[opline_num].result.u.opline_num;
859859
}
860-
zend_restore_compiled_filename(orig_compiled_filename);
860+
zend_restore_compiled_filename(orig_compiled_filename TSRMLS_CC);
861861
CG(in_compilation) = orig_in_compilation;
862862
}
863863
}

0 commit comments

Comments
 (0)