mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Fixed bug #73663 ("Invalid opcode 65/16/8" occurs with a variable created with list())
This commit is contained in:
parent
183b4d78aa
commit
358bd77b23
3 changed files with 85 additions and 1 deletions
2
NEWS
2
NEWS
|
@ -3,6 +3,8 @@ PHP NEWS
|
||||||
?? ??? 2016 PHP 7.0.15
|
?? ??? 2016 PHP 7.0.15
|
||||||
|
|
||||||
- Core:
|
- Core:
|
||||||
|
. Fixed bug #73663 ("Invalid opcode 65/16/8" occurs with a variable created
|
||||||
|
with list()). (Laruence)
|
||||||
. Fixed bug #73585 (Logging of "Internal Zend error - Missing class
|
. Fixed bug #73585 (Logging of "Internal Zend error - Missing class
|
||||||
information" missing class name). (Laruence)
|
information" missing class name). (Laruence)
|
||||||
|
|
||||||
|
|
73
Zend/tests/bug73663.phpt
Normal file
73
Zend/tests/bug73663.phpt
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #73663 ("Invalid opcode 65/16/8" occurs with a variable created with list())
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
function change(&$ref) {
|
||||||
|
$ref = range(1, 10);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$func = function (&$ref) {
|
||||||
|
return change($ref);
|
||||||
|
};
|
||||||
|
|
||||||
|
$array = [1];
|
||||||
|
var_dump(list($val) = $array); // NG: Invalid opcode
|
||||||
|
|
||||||
|
change(list($val) = $array);
|
||||||
|
var_dump($array);
|
||||||
|
|
||||||
|
$array = [1];
|
||||||
|
|
||||||
|
$func(list($val) = $array);
|
||||||
|
var_dump($array);
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
int(1)
|
||||||
|
}
|
||||||
|
array(10) {
|
||||||
|
[0]=>
|
||||||
|
int(1)
|
||||||
|
[1]=>
|
||||||
|
int(2)
|
||||||
|
[2]=>
|
||||||
|
int(3)
|
||||||
|
[3]=>
|
||||||
|
int(4)
|
||||||
|
[4]=>
|
||||||
|
int(5)
|
||||||
|
[5]=>
|
||||||
|
int(6)
|
||||||
|
[6]=>
|
||||||
|
int(7)
|
||||||
|
[7]=>
|
||||||
|
int(8)
|
||||||
|
[8]=>
|
||||||
|
int(9)
|
||||||
|
[9]=>
|
||||||
|
int(10)
|
||||||
|
}
|
||||||
|
array(10) {
|
||||||
|
[0]=>
|
||||||
|
int(1)
|
||||||
|
[1]=>
|
||||||
|
int(2)
|
||||||
|
[2]=>
|
||||||
|
int(3)
|
||||||
|
[3]=>
|
||||||
|
int(4)
|
||||||
|
[4]=>
|
||||||
|
int(5)
|
||||||
|
[5]=>
|
||||||
|
int(6)
|
||||||
|
[6]=>
|
||||||
|
int(7)
|
||||||
|
[7]=>
|
||||||
|
int(8)
|
||||||
|
[8]=>
|
||||||
|
int(9)
|
||||||
|
[9]=>
|
||||||
|
int(10)
|
||||||
|
}
|
|
@ -2781,12 +2781,21 @@ uint32_t zend_compile_args(zend_ast *ast, zend_function *fbc) /* {{{ */
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
zend_compile_expr(&arg_node, arg);
|
zend_compile_expr(&arg_node, arg);
|
||||||
ZEND_ASSERT(arg_node.op_type != IS_CV);
|
|
||||||
if (arg_node.op_type == IS_VAR) {
|
if (arg_node.op_type == IS_VAR) {
|
||||||
opcode = ZEND_SEND_VAR_NO_REF;
|
opcode = ZEND_SEND_VAR_NO_REF;
|
||||||
if (fbc && ARG_MUST_BE_SENT_BY_REF(fbc, arg_num)) {
|
if (fbc && ARG_MUST_BE_SENT_BY_REF(fbc, arg_num)) {
|
||||||
flags |= ZEND_ARG_SEND_BY_REF;
|
flags |= ZEND_ARG_SEND_BY_REF;
|
||||||
}
|
}
|
||||||
|
} else if (arg_node.op_type == IS_CV) {
|
||||||
|
if (fbc) {
|
||||||
|
if (ARG_SHOULD_BE_SENT_BY_REF(fbc, arg_num)) {
|
||||||
|
opcode = ZEND_SEND_REF;
|
||||||
|
} else {
|
||||||
|
opcode = ZEND_SEND_VAR;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
opcode = ZEND_SEND_VAR_EX;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (fbc) {
|
if (fbc) {
|
||||||
opcode = ZEND_SEND_VAL;
|
opcode = ZEND_SEND_VAL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue