Skip to content

Commit d92f763

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
2 parents 9afce01 + 4daa413 commit d92f763

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ PHP NEWS
88

99
- Opcache:
1010
. Fixed bug #77058 (Type inference in opcache causes side effects). (Nikita)
11+
. Fixed bug #77092 (array_diff_key() - segmentation fault). (Nikita)
1112

1213
- SOAP:
1314
. Fixed bug #50675 (SoapClient can't handle object references correctly).

ext/opcache/Optimizer/sccp.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ static inline int ct_eval_in_array(zval *result, uint32_t extended_value, zval *
705705
static inline int ct_eval_func_call(
706706
zval *result, zend_string *name, uint32_t num_args, zval **args) {
707707
uint32_t i;
708-
zend_execute_data *execute_data;
708+
zend_execute_data *execute_data, *prev_execute_data;
709709
zend_function *func;
710710
int overflow;
711711

@@ -960,6 +960,9 @@ static inline int ct_eval_func_call(
960960

961961
execute_data = safe_emalloc(num_args, sizeof(zval), ZEND_CALL_FRAME_SLOT * sizeof(zval));
962962
memset(execute_data, 0, sizeof(zend_execute_data));
963+
prev_execute_data = EG(current_execute_data);
964+
EG(current_execute_data) = execute_data;
965+
963966
EX(func) = func;
964967
EX_NUM_ARGS() = num_args;
965968
for (i = 0; i < num_args; i++) {
@@ -970,6 +973,7 @@ static inline int ct_eval_func_call(
970973
zval_ptr_dtor_nogc(EX_VAR_NUM(i));
971974
}
972975
efree(execute_data);
976+
EG(current_execute_data) = prev_execute_data;
973977
return SUCCESS;
974978
}
975979

ext/opcache/tests/bug77092.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Bug #77092: array_diff_key() - segmentation fault
3+
--INI--
4+
opcache.enable_cli=1
5+
opcache.optimization_level=-1
6+
--FILE--
7+
<?php
8+
function test() {
9+
$anyArrayOne = ['foo' => 'bar', 'bar' => 'baz'];
10+
$anyArrayTwo = ['foo' => null];
11+
12+
print_r(array_diff_key($anyArrayOne, $anyArrayTwo));
13+
}
14+
test();
15+
?>
16+
--EXPECT--
17+
Array
18+
(
19+
[bar] => baz
20+
)

0 commit comments

Comments
 (0)