Skip to content

Commit c38310f

Browse files
committed
change fcall and statement handlers to accept frame
1 parent ee55110 commit c38310f

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

Diff for: NEWS

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ PHP NEWS
33
?? ??? 2016, PHP 7.1.0
44

55
- Core:
6+
. Change statement and fcall extension handlers to accept frame. (Joe)
67
. Implemented safe execution timeout handling, that prevents rundom crashes
78
after "Maximum execution time exceeded" error. (Dmitry)
89
. Fixed bug #62210 (Exceptions can leak temporary variables). (Dmitry, Bob)

Diff for: Zend/zend_execute.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ typedef int (ZEND_FASTCALL *incdec_t)(zval *);
6565
#define get_obj_zval_ptr_ptr(op_type, node, ex, should_free, type) _get_obj_zval_ptr_ptr(op_type, node, ex, should_free, type)
6666

6767
/* Prototypes */
68-
static void zend_extension_statement_handler(const zend_extension *extension, zend_op_array *op_array);
69-
static void zend_extension_fcall_begin_handler(const zend_extension *extension, zend_op_array *op_array);
70-
static void zend_extension_fcall_end_handler(const zend_extension *extension, zend_op_array *op_array);
68+
static void zend_extension_statement_handler(const zend_extension *extension, zend_execute_data *frame);
69+
static void zend_extension_fcall_begin_handler(const zend_extension *extension, zend_execute_data *frame);
70+
static void zend_extension_fcall_end_handler(const zend_extension *extension, zend_execute_data *frame);
7171

7272
#define RETURN_VALUE_USED(opline) ((opline)->result_type != IS_UNUSED)
7373

@@ -1508,26 +1508,26 @@ static zend_never_inline void zend_assign_op_overloaded_property(zval *object, z
15081508
}
15091509

15101510
/* Utility Functions for Extensions */
1511-
static void zend_extension_statement_handler(const zend_extension *extension, zend_op_array *op_array)
1511+
static void zend_extension_statement_handler(const zend_extension *extension, zend_execute_data *frame)
15121512
{
15131513
if (extension->statement_handler) {
1514-
extension->statement_handler(op_array);
1514+
extension->statement_handler(frame);
15151515
}
15161516
}
15171517

15181518

1519-
static void zend_extension_fcall_begin_handler(const zend_extension *extension, zend_op_array *op_array)
1519+
static void zend_extension_fcall_begin_handler(const zend_extension *extension, zend_execute_data *frame)
15201520
{
15211521
if (extension->fcall_begin_handler) {
1522-
extension->fcall_begin_handler(op_array);
1522+
extension->fcall_begin_handler(frame);
15231523
}
15241524
}
15251525

15261526

1527-
static void zend_extension_fcall_end_handler(const zend_extension *extension, zend_op_array *op_array)
1527+
static void zend_extension_fcall_end_handler(const zend_extension *extension, zend_execute_data *frame)
15281528
{
15291529
if (extension->fcall_end_handler) {
1530-
extension->fcall_end_handler(op_array);
1530+
extension->fcall_end_handler(frame);
15311531
}
15321532
}
15331533

Diff for: Zend/zend_extensions.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ typedef void (*message_handler_func_t)(int message, void *arg);
6767

6868
typedef void (*op_array_handler_func_t)(zend_op_array *op_array);
6969

70-
typedef void (*statement_handler_func_t)(zend_op_array *op_array);
71-
typedef void (*fcall_begin_handler_func_t)(zend_op_array *op_array);
72-
typedef void (*fcall_end_handler_func_t)(zend_op_array *op_array);
70+
typedef void (*statement_handler_func_t)(zend_execute_data *frame);
71+
typedef void (*fcall_begin_handler_func_t)(zend_execute_data *frame);
72+
typedef void (*fcall_end_handler_func_t)(zend_execute_data *frame);
7373

7474
typedef void (*op_array_ctor_func_t)(zend_op_array *op_array);
7575
typedef void (*op_array_dtor_func_t)(zend_op_array *op_array);

Diff for: Zend/zend_vm_def.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -6796,7 +6796,7 @@ ZEND_VM_HANDLER(101, ZEND_EXT_STMT, ANY, ANY)
67966796

67976797
if (!EG(no_extensions)) {
67986798
SAVE_OPLINE();
6799-
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_statement_handler, EX(func));
6799+
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_statement_handler, execute_data);
68006800
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
68016801
}
68026802
ZEND_VM_NEXT_OPCODE();
@@ -6808,7 +6808,7 @@ ZEND_VM_HANDLER(102, ZEND_EXT_FCALL_BEGIN, ANY, ANY)
68086808

68096809
if (!EG(no_extensions)) {
68106810
SAVE_OPLINE();
6811-
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_begin_handler, EX(func));
6811+
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_begin_handler, execute_data);
68126812
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
68136813
}
68146814
ZEND_VM_NEXT_OPCODE();
@@ -6820,7 +6820,7 @@ ZEND_VM_HANDLER(103, ZEND_EXT_FCALL_END, ANY, ANY)
68206820

68216821
if (!EG(no_extensions)) {
68226822
SAVE_OPLINE();
6823-
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_end_handler, EX(func));
6823+
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_end_handler, execute_data);
68246824
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
68256825
}
68266826
ZEND_VM_NEXT_OPCODE();

Diff for: Zend/zend_vm_execute.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1534,7 +1534,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_EXT_STMT_SPEC_HANDLER(ZEND_OPC
15341534

15351535
if (!EG(no_extensions)) {
15361536
SAVE_OPLINE();
1537-
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_statement_handler, EX(func));
1537+
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_statement_handler, execute_data);
15381538
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
15391539
}
15401540
ZEND_VM_NEXT_OPCODE();
@@ -1546,7 +1546,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_EXT_FCALL_BEGIN_SPEC_HANDLER(Z
15461546

15471547
if (!EG(no_extensions)) {
15481548
SAVE_OPLINE();
1549-
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_begin_handler, EX(func));
1549+
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_begin_handler, execute_data);
15501550
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
15511551
}
15521552
ZEND_VM_NEXT_OPCODE();
@@ -1558,7 +1558,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_EXT_FCALL_END_SPEC_HANDLER(ZEN
15581558

15591559
if (!EG(no_extensions)) {
15601560
SAVE_OPLINE();
1561-
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_end_handler, EX(func));
1561+
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_end_handler, execute_data);
15621562
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
15631563
}
15641564
ZEND_VM_NEXT_OPCODE();

0 commit comments

Comments
 (0)