summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2013-12-13 11:15:38 +0400
committerDmitry Stogov <dmitry@zend.com>2013-12-13 11:15:38 +0400
commit9b829c92b5b28af00510b6cfe708ea90184f8381 (patch)
tree85f821ffe6f980cd3d591df01e09e451944c4f76
parentfd4a7388d781cab1782178ee4984a21183ee9af5 (diff)
parent914de05bf59ba91d39b6b3f3e914fd2a456d0133 (diff)
downloadphp-git-9b829c92b5b28af00510b6cfe708ea90184f8381.tar.gz
Merge branch 'master' of git.php.net:php-src
* 'master' of git.php.net:php-src: Use zend_error_noreturn here OCI8 build change: Fix source variable definition for C89 compatibility Kill another TSRMLS_FETCH() in zend_indent() Eliminate another straight forward TSRMLS_FETCH() in zend_startup_module() Fix build Add Tests for #65784 in 5.5 Disallowed JMP into a finally block. Update NEWS for 5.5.7 release Fixed bug #65784 (Segfault with finally).
-rw-r--r--Zend/tests/bug65784.phpt60
-rw-r--r--Zend/tests/finally_goto_001.phpt14
-rw-r--r--Zend/tests/finally_goto_002.phpt14
-rw-r--r--Zend/tests/finally_goto_003.phpt15
-rw-r--r--Zend/tests/finally_goto_004.phpt14
-rw-r--r--Zend/zend_API.c4
-rw-r--r--Zend/zend_API.h2
-rw-r--r--Zend/zend_compile.h1
-rw-r--r--Zend/zend_execute.c1
-rw-r--r--Zend/zend_indent.c3
-rw-r--r--Zend/zend_indent.h2
-rw-r--r--Zend/zend_object_handlers.c1
-rw-r--r--Zend/zend_opcode.c25
-rw-r--r--Zend/zend_vm_def.h49
-rw-r--r--Zend/zend_vm_execute.h49
-rw-r--r--ext/opcache/ZendAccelerator.c4
-rw-r--r--ext/opcache/ZendAccelerator.h1
-rw-r--r--ext/opcache/zend_accelerator_module.c7
-rw-r--r--ext/opcache/zend_accelerator_module.h5
-rw-r--r--main/main.c4
-rw-r--r--sapi/cgi/cgi_main.c2
-rw-r--r--sapi/cli/php_cli.c2
-rw-r--r--sapi/pi3web/pi3web_sapi.c2
-rw-r--r--sapi/thttpd/thttpd.c3
24 files changed, 233 insertions, 51 deletions
diff --git a/Zend/tests/bug65784.phpt b/Zend/tests/bug65784.phpt
new file mode 100644
index 0000000000..29f086b5e3
--- /dev/null
+++ b/Zend/tests/bug65784.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Fixed Bug #65784 (Segfault with finally)
+--FILE--
+<?php
+function foo1() {
+ try {
+ throw new Exception("not catch");
+ return true;
+ } finally {
+ try {
+ throw new Exception("catched");
+ } catch (Exception $e) {
+ }
+ }
+}
+try {
+ $foo = foo1();
+ var_dump($foo);
+} catch (Exception $e) {
+ do {
+ var_dump($e->getMessage());
+ } while ($e = $e->getPrevious());
+}
+
+function foo2() {
+ try {
+ try {
+ throw new Exception("catched");
+ return true;
+ } finally {
+ try {
+ throw new Exception("catched");
+ } catch (Exception $e) {
+ }
+ }
+ } catch (Exception $e) {
+ }
+}
+
+$foo = foo2();
+var_dump($foo);
+
+function foo3() {
+ try {
+ throw new Exception("not catched");
+ return true;
+ } finally {
+ try {
+ throw new NotExists();
+ } catch (Exception $e) {
+ }
+ }
+}
+
+$bar = foo3();
+--EXPECTF--
+string(9) "not catch"
+NULL
+
+Fatal error: Class 'NotExists' not found in %sbug65784.php on line %d
diff --git a/Zend/tests/finally_goto_001.phpt b/Zend/tests/finally_goto_001.phpt
new file mode 100644
index 0000000000..990f78d4c7
--- /dev/null
+++ b/Zend/tests/finally_goto_001.phpt
@@ -0,0 +1,14 @@
+--TEST--
+jmp into a finally block 01
+--FILE--
+<?php
+function foo() {
+ goto test;
+ try {
+ } finally {
+test:
+ }
+}
+?>
+--EXPECTF--
+Fatal error: jump into a finally block is disallowed in %sfinally_goto_001.php on line %d
diff --git a/Zend/tests/finally_goto_002.phpt b/Zend/tests/finally_goto_002.phpt
new file mode 100644
index 0000000000..a6bd9e307f
--- /dev/null
+++ b/Zend/tests/finally_goto_002.phpt
@@ -0,0 +1,14 @@
+--TEST--
+jmp into a finally block 02
+--FILE--
+<?php
+function foo() {
+ try {
+ goto test;
+ } finally {
+test:
+ }
+}
+?>
+--EXPECTF--
+Fatal error: jump into a finally block is disallowed in %sfinally_goto_002.php on line %d
diff --git a/Zend/tests/finally_goto_003.phpt b/Zend/tests/finally_goto_003.phpt
new file mode 100644
index 0000000000..8529ff7865
--- /dev/null
+++ b/Zend/tests/finally_goto_003.phpt
@@ -0,0 +1,15 @@
+--TEST--
+jmp into a finally block 03
+--FILE--
+<?php
+function foo() {
+ try {
+ } finally {
+ goto test;
+test:
+ }
+}
+echo "okey";
+?>
+--EXPECTF--
+okey
diff --git a/Zend/tests/finally_goto_004.phpt b/Zend/tests/finally_goto_004.phpt
new file mode 100644
index 0000000000..d88ceedf52
--- /dev/null
+++ b/Zend/tests/finally_goto_004.phpt
@@ -0,0 +1,14 @@
+--TEST--
+jmp into a finally block 03
+--FILE--
+<?php
+function foo() {
+ try {
+ } finally {
+test:
+ }
+ goto test;
+}
+?>
+--EXPECTF--
+Fatal error: jump into a finally block is disallowed in %sfinally_goto_004.php on line %d
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 18f151e0ef..b3f59a71f1 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -2313,10 +2313,8 @@ ZEND_API void zend_unregister_functions(const zend_function_entry *functions, in
}
/* }}} */
-ZEND_API int zend_startup_module(zend_module_entry *module) /* {{{ */
+ZEND_API int zend_startup_module(zend_module_entry *module TSRMLS_DC) /* {{{ */
{
- TSRMLS_FETCH();
-
if ((module = zend_register_internal_module(module TSRMLS_CC)) != NULL && zend_startup_module_ex(module TSRMLS_CC) == SUCCESS) {
return SUCCESS;
}
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index 007d989609..c426acf497 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -266,7 +266,7 @@ ZEND_API int zend_parse_parameter(int flags, int arg_num TSRMLS_DC, zval **arg,
ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC);
ZEND_API void zend_unregister_functions(const zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC);
-ZEND_API int zend_startup_module(zend_module_entry *module_entry);
+ZEND_API int zend_startup_module(zend_module_entry *module_entry TSRMLS_DC);
ZEND_API zend_module_entry* zend_register_internal_module(zend_module_entry *module_entry TSRMLS_DC);
ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TSRMLS_DC);
ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC);
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index e3f06a0012..5d89a2b5c0 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -401,6 +401,7 @@ struct _zend_execute_data {
zend_class_entry *current_called_scope;
zval *current_this;
struct _zend_op *fast_ret; /* used by FAST_CALL/FAST_RET (finally keyword) */
+ zval *delayed_exception;
call_slot *call_slots;
call_slot *call;
};
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 5aea39ea94..5c6d3e780b 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -1650,6 +1650,7 @@ static zend_always_inline zend_execute_data *i_create_execute_data_from_op_array
EX(call) = NULL;
EG(current_execute_data) = execute_data;
EX(nested) = nested;
+ EX(delayed_exception) = NULL;
if (!op_array->run_time_cache && op_array->last_cache_slot) {
op_array->run_time_cache = ecalloc(op_array->last_cache_slot, sizeof(void*));
diff --git a/Zend/zend_indent.c b/Zend/zend_indent.c
index fea78d9c57..42e4321b3d 100644
--- a/Zend/zend_indent.c
+++ b/Zend/zend_indent.c
@@ -47,7 +47,7 @@ static void handle_whitespace(int *emit_whitespace)
}
-ZEND_API void zend_indent()
+ZEND_API void zend_indent(TSRMLS_D)
{
zval token;
int token_type;
@@ -55,7 +55,6 @@ ZEND_API void zend_indent()
int nest_level=0;
int emit_whitespace[256];
int i;
- TSRMLS_FETCH();
memset(emit_whitespace, 0, sizeof(int)*256);
diff --git a/Zend/zend_indent.h b/Zend/zend_indent.h
index bba02a738b..f38e87eaef 100644
--- a/Zend/zend_indent.h
+++ b/Zend/zend_indent.h
@@ -23,7 +23,7 @@
#define ZEND_INDENT_H
BEGIN_EXTERN_C()
-ZEND_API void zend_indent(void);
+ZEND_API void zend_indent(TSRMLS_D);
END_EXTERN_C()
#endif /* ZEND_INDENT_H */
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index 8beacdfd35..438df16426 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -29,6 +29,7 @@
#include "zend_interfaces.h"
#include "zend_closures.h"
#include "zend_compile.h"
+#include "zend_hash.h"
#define DEBUG_OBJECT_HANDLERS 0
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index ad08798884..ac16e81ef1 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -489,10 +489,15 @@ static void zend_check_finally_breakout(zend_op_array *op_array, zend_uint op_nu
zend_uint i;
for (i = 0; i < op_array->last_try_catch; i++) {
- if (op_array->try_catch_array[i].try_op > op_num) {
- break;
- }
- if ((op_num >= op_array->try_catch_array[i].finally_op
+ if ((op_num < op_array->try_catch_array[i].finally_op ||
+ op_num >= op_array->try_catch_array[i].finally_end)
+ && (dst_num >= op_array->try_catch_array[i].finally_op &&
+ dst_num <= op_array->try_catch_array[i].finally_end)) {
+ CG(in_compilation) = 1;
+ CG(active_op_array) = op_array;
+ CG(zend_lineno) = op_array->opcodes[op_num].lineno;
+ zend_error_noreturn(E_COMPILE_ERROR, "jump into a finally block is disallowed");
+ } else if ((op_num >= op_array->try_catch_array[i].finally_op
&& op_num <= op_array->try_catch_array[i].finally_end)
&& (dst_num > op_array->try_catch_array[i].finally_end
|| dst_num < op_array->try_catch_array[i].finally_op)) {
@@ -541,11 +546,11 @@ static void zend_resolve_finally_call(zend_op_array *op_array, zend_uint op_num,
while (i > 0) {
i--;
if (op_array->try_catch_array[i].finally_op &&
- op_num >= op_array->try_catch_array[i].try_op &&
- op_num < op_array->try_catch_array[i].finally_op - 1 &&
- (dst_num < op_array->try_catch_array[i].try_op ||
- dst_num > op_array->try_catch_array[i].finally_end)) {
-
+ op_num >= op_array->try_catch_array[i].try_op &&
+ op_num < op_array->try_catch_array[i].finally_op - 1 &&
+ (dst_num < op_array->try_catch_array[i].try_op ||
+ dst_num > op_array->try_catch_array[i].finally_end)) {
+
opline = get_next_op(op_array TSRMLS_CC);
opline->opcode = ZEND_FAST_CALL;
SET_UNUSED(opline->op1);
@@ -565,7 +570,7 @@ static void zend_resolve_finally_call(zend_op_array *op_array, zend_uint op_num,
SET_UNUSED(opline->op2);
opline->op1.opline_num = start_op;
- break;
+ break;
}
}
}
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index f4224433ef..5385f3eec9 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -5021,7 +5021,7 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
{
zend_uint op_num = EG(opline_before_exception)-EG(active_op_array)->opcodes;
int i;
- zend_uint catch_op_num = 0, finally_op_num = 0;
+ zend_uint catch_op_num = 0, finally_op_num = 0, finally_op_end = 0;
void **stack_frame;
/* Figure out where the next stack frame (which maybe contains pushed
@@ -5046,6 +5046,10 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) {
finally_op_num = EX(op_array)->try_catch_array[i].finally_op;
}
+ if (op_num >= EG(active_op_array)->try_catch_array[i].finally_op &&
+ op_num < EG(active_op_array)->try_catch_array[i].finally_end) {
+ finally_op_end = EG(active_op_array)->try_catch_array[i].finally_end;
+ }
}
if (EX(call) >= EX(call_slots)) {
@@ -5107,14 +5111,29 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
EX(old_error_reporting) = NULL;
if (finally_op_num && (!catch_op_num || catch_op_num >= finally_op_num)) {
- zend_exception_save(TSRMLS_C);
+ if (EX(delayed_exception)) {
+ zend_exception_set_previous(EG(exception), EX(delayed_exception) TSRMLS_CC);
+ }
+ EX(delayed_exception) = EG(exception);
+ EG(exception) = NULL;
EX(fast_ret) = NULL;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
ZEND_VM_CONTINUE();
} else if (catch_op_num) {
+ if (finally_op_end && catch_op_num > finally_op_end) {
+ /* we are going out of current finally scope */
+ if (EX(delayed_exception)) {
+ zend_exception_set_previous(EG(exception), EX(delayed_exception) TSRMLS_CC);
+ EX(delayed_exception) = NULL;
+ }
+ }
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
ZEND_VM_CONTINUE();
} else {
+ if (EX(delayed_exception)) {
+ zend_exception_set_previous(EG(exception), EX(delayed_exception) TSRMLS_CC);
+ EX(delayed_exception) = NULL;
+ }
if (UNEXPECTED((EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) != 0)) {
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_GENERATOR_RETURN);
} else {
@@ -5405,10 +5424,10 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE
ZEND_VM_HANDLER(159, ZEND_DISCARD_EXCEPTION, ANY, ANY)
{
- if (EG(prev_exception) != NULL) {
+ if (EX(delayed_exception) != NULL) {
/* discard the previously thrown exception */
- zval_ptr_dtor(&EG(prev_exception));
- EG(prev_exception) = NULL;
+ zval_ptr_dtor(&EX(delayed_exception));
+ EX(delayed_exception) = NULL;
}
ZEND_VM_NEXT_OPCODE();
@@ -5425,6 +5444,7 @@ ZEND_VM_HANDLER(162, ZEND_FAST_CALL, ANY, ANY)
ZEND_VM_CONTINUE();
}
EX(fast_ret) = opline + 1;
+ EX(delayed_exception) = NULL;
ZEND_VM_SET_OPCODE(opline->op1.jmp_addr);
ZEND_VM_CONTINUE();
}
@@ -5441,16 +5461,17 @@ ZEND_VM_HANDLER(163, ZEND_FAST_RET, ANY, ANY)
if (opline->extended_value == ZEND_FAST_RET_TO_FINALLY) {
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.opline_num]);
ZEND_VM_CONTINUE();
- } else if (opline->extended_value == ZEND_FAST_RET_TO_CATCH) {
- zend_exception_restore(TSRMLS_C);
- ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.opline_num]);
- ZEND_VM_CONTINUE();
- } else if (UNEXPECTED((EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) != 0)) {
- zend_exception_restore(TSRMLS_C);
- ZEND_VM_DISPATCH_TO_HANDLER(ZEND_GENERATOR_RETURN);
} else {
- zend_exception_restore(TSRMLS_C);
- ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
+ EG(exception) = EX(delayed_exception);
+ EX(delayed_exception) = NULL;
+ if (opline->extended_value == ZEND_FAST_RET_TO_CATCH) {
+ ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.opline_num]);
+ ZEND_VM_CONTINUE();
+ } else if (UNEXPECTED((EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) != 0)) {
+ ZEND_VM_DISPATCH_TO_HANDLER(ZEND_GENERATOR_RETURN);
+ } else {
+ ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
+ }
}
}
}
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 77672a3d86..02f8acb6be 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -1016,7 +1016,7 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER
{
zend_uint op_num = EG(opline_before_exception)-EG(active_op_array)->opcodes;
int i;
- zend_uint catch_op_num = 0, finally_op_num = 0;
+ zend_uint catch_op_num = 0, finally_op_num = 0, finally_op_end = 0;
void **stack_frame;
/* Figure out where the next stack frame (which maybe contains pushed
@@ -1041,6 +1041,10 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER
if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) {
finally_op_num = EX(op_array)->try_catch_array[i].finally_op;
}
+ if (op_num >= EG(active_op_array)->try_catch_array[i].finally_op &&
+ op_num < EG(active_op_array)->try_catch_array[i].finally_end) {
+ finally_op_end = EG(active_op_array)->try_catch_array[i].finally_end;
+ }
}
if (EX(call) >= EX(call_slots)) {
@@ -1102,14 +1106,29 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER
EX(old_error_reporting) = NULL;
if (finally_op_num && (!catch_op_num || catch_op_num >= finally_op_num)) {
- zend_exception_save(TSRMLS_C);
+ if (EX(delayed_exception)) {
+ zend_exception_set_previous(EG(exception), EX(delayed_exception) TSRMLS_CC);
+ }
+ EX(delayed_exception) = EG(exception);
+ EG(exception) = NULL;
EX(fast_ret) = NULL;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
ZEND_VM_CONTINUE();
} else if (catch_op_num) {
+ if (finally_op_end && catch_op_num > finally_op_end) {
+ /* we are going out of current finally scope */
+ if (EX(delayed_exception)) {
+ zend_exception_set_previous(EG(exception), EX(delayed_exception) TSRMLS_CC);
+ EX(delayed_exception) = NULL;
+ }
+ }
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
ZEND_VM_CONTINUE();
} else {
+ if (EX(delayed_exception)) {
+ zend_exception_set_previous(EG(exception), EX(delayed_exception) TSRMLS_CC);
+ EX(delayed_exception) = NULL;
+ }
if (UNEXPECTED((EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) != 0)) {
return ZEND_GENERATOR_RETURN_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else {
@@ -1159,10 +1178,10 @@ static int ZEND_FASTCALL ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS
static int ZEND_FASTCALL ZEND_DISCARD_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
- if (EG(prev_exception) != NULL) {
+ if (EX(delayed_exception) != NULL) {
/* discard the previously thrown exception */
- zval_ptr_dtor(&EG(prev_exception));
- EG(prev_exception) = NULL;
+ zval_ptr_dtor(&EX(delayed_exception));
+ EX(delayed_exception) = NULL;
}
ZEND_VM_NEXT_OPCODE();
@@ -1179,6 +1198,7 @@ static int ZEND_FASTCALL ZEND_FAST_CALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
ZEND_VM_CONTINUE();
}
EX(fast_ret) = opline + 1;
+ EX(delayed_exception) = NULL;
ZEND_VM_SET_OPCODE(opline->op1.jmp_addr);
ZEND_VM_CONTINUE();
}
@@ -1195,16 +1215,17 @@ static int ZEND_FASTCALL ZEND_FAST_RET_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (opline->extended_value == ZEND_FAST_RET_TO_FINALLY) {
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.opline_num]);
ZEND_VM_CONTINUE();
- } else if (opline->extended_value == ZEND_FAST_RET_TO_CATCH) {
- zend_exception_restore(TSRMLS_C);
- ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.opline_num]);
- ZEND_VM_CONTINUE();
- } else if (UNEXPECTED((EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) != 0)) {
- zend_exception_restore(TSRMLS_C);
- return ZEND_GENERATOR_RETURN_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else {
- zend_exception_restore(TSRMLS_C);
- return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ EG(exception) = EX(delayed_exception);
+ EX(delayed_exception) = NULL;
+ if (opline->extended_value == ZEND_FAST_RET_TO_CATCH) {
+ ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.opline_num]);
+ ZEND_VM_CONTINUE();
+ } else if (UNEXPECTED((EX(op_array)->fn_flags & ZEND_ACC_GENERATOR) != 0)) {
+ return ZEND_GENERATOR_RETURN_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ } else {
+ return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ }
}
}
}
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 9398b58ac6..69a5d386d2 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -2528,7 +2528,11 @@ static int accel_startup(zend_extension *extension)
_setmaxstdio(2048); /* The default configuration is limited to 512 stdio files */
#endif
+#if ZEND_EXTENSION_API_NO > PHP_5_6_X_API_NO
+ if (start_accel_module(TSRMLS_C) == FAILURE) {
+#else
if (start_accel_module() == FAILURE) {
+#endif
accel_startup_ok = 0;
zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME ": module registration failed!");
return FAILURE;
diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h
index 487010ba27..7ffd0126b3 100644
--- a/ext/opcache/ZendAccelerator.h
+++ b/ext/opcache/ZendAccelerator.h
@@ -92,6 +92,7 @@
#define PHP_5_3_X_API_NO 220090626
#define PHP_5_4_X_API_NO 220100525
#define PHP_5_5_X_API_NO 220121212
+#define PHP_5_6_X_API_NO 220131106
/*** file locking ***/
#ifndef ZEND_WIN32
diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c
index cd840fd7dd..1034e3e05d 100644
--- a/ext/opcache/zend_accelerator_module.c
+++ b/ext/opcache/zend_accelerator_module.c
@@ -468,10 +468,17 @@ static zend_module_entry accel_module_entry = {
STANDARD_MODULE_PROPERTIES
};
+#if ZEND_EXTENSION_API_NO > PHP_5_6_X_API_NO
+int start_accel_module(TSRMLS_D)
+{
+ return zend_startup_module(&accel_module_entry TSRMLS_CC);
+}
+#else
int start_accel_module(void)
{
return zend_startup_module(&accel_module_entry);
}
+#endif
/* {{{ proto array accelerator_get_scripts()
Get the scripts which are accelerated by ZendAccelerator */
diff --git a/ext/opcache/zend_accelerator_module.h b/ext/opcache/zend_accelerator_module.h
index 539b4e85af..74728f3f72 100644
--- a/ext/opcache/zend_accelerator_module.h
+++ b/ext/opcache/zend_accelerator_module.h
@@ -22,7 +22,12 @@
#ifndef ZEND_ACCELERATOR_MODULE_H
#define ZEND_ACCELERATOR_MODULE_H
+#if ZEND_EXTENSION_API_NO > PHP_5_6_X_API_NO
+int start_accel_module(TSRMLS_D);
+#else
int start_accel_module(void);
+#endif
+
void zend_accel_override_file_functions(TSRMLS_D);
#endif /* _ZEND_ACCELERATOR_MODULE_H */
diff --git a/main/main.c b/main/main.c
index 6f7e149cad..05b34b7f3a 100644
--- a/main/main.c
+++ b/main/main.c
@@ -2643,9 +2643,9 @@ PHPAPI int php_lint_script(zend_file_handle *file TSRMLS_DC)
#ifdef PHP_WIN32
/* {{{ dummy_indent
just so that this symbol gets exported... */
-PHPAPI void dummy_indent(void)
+PHPAPI void dummy_indent(TSRMLS_D)
{
- zend_indent();
+ zend_indent(TSRMLS_C);
}
/* }}} */
#endif
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index c36729437a..ea75ee83ba 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -2493,7 +2493,7 @@ consult the installation file that came with this distribution, or visit \n\
/* Zeev might want to do something with this one day */
case PHP_MODE_INDENT:
open_file_for_scanning(&file_handle TSRMLS_CC);
- zend_indent();
+ zend_indent(TSRMLS_C);
zend_file_handle_dtor(&file_handle TSRMLS_CC);
php_output_teardown();
return SUCCESS;
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 9f3fc4b5b7..eec117ab1f 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -1024,7 +1024,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */
/* Zeev might want to do something with this one day */
case PHP_MODE_INDENT:
open_file_for_scanning(&file_handle TSRMLS_CC);
- zend_indent();
+ zend_indent(TSRMLS_C);
zend_file_handle_dtor(file_handle.handle TSRMLS_CC);
goto out;
break;
diff --git a/sapi/pi3web/pi3web_sapi.c b/sapi/pi3web/pi3web_sapi.c
index 64eb2a6c99..b9076f17d8 100644
--- a/sapi/pi3web/pi3web_sapi.c
+++ b/sapi/pi3web/pi3web_sapi.c
@@ -385,7 +385,7 @@ MODULE_API DWORD PHP5_wrapper(LPCONTROL_BLOCK lpCB)
}
if ( open_file_for_scanning( &file_handle TSRMLS_CC ) == SUCCESS )
{
- zend_indent();
+ zend_indent(TSRMLS_C);
}
else
{
diff --git a/sapi/thttpd/thttpd.c b/sapi/thttpd/thttpd.c
index 548bcda170..b136b71d7b 100644
--- a/sapi/thttpd/thttpd.c
+++ b/sapi/thttpd/thttpd.c
@@ -349,11 +349,12 @@ static zend_module_entry php_thttpd_module = {
STANDARD_MODULE_PROPERTIES
};
-static int php_thttpd_startup(sapi_module_struct *sapi_module)
+static int php_thttpd_startup(sapi_module_struct *sapi_module TSRMLS_DC)
{
#if PHP_API_VERSION >= 20020918
if (php_module_startup(sapi_module, &php_thttpd_module, 1) == FAILURE) {
#else
+ /* No TSRMLS_CC here to zend_startup_module() as 5.6 and older does not have that parameter */
if (php_module_startup(sapi_module) == FAILURE
|| zend_startup_module(&php_thttpd_module) == FAILURE) {
#endif