mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
Bug #71756 (Call-by-reference widens scope to uninvolved functions when used in switch)
This commit is contained in:
parent
7d5f71b0b1
commit
9833c76d3f
2
NEWS
2
NEWS
@ -6,6 +6,8 @@ PHP NEWS
|
|||||||
. Fixed bug #69953 (Support MKCALENDAR request method). (Christoph)
|
. Fixed bug #69953 (Support MKCALENDAR request method). (Christoph)
|
||||||
|
|
||||||
- Core:
|
- Core:
|
||||||
|
. Fixed bug #71756 (Call-by-reference widens scope to uninvolved functions
|
||||||
|
when used in switch). (Laruence)
|
||||||
. Fixed bug #71729 (Possible crash in zend_bin_strtod, zend_oct_strtod,
|
. Fixed bug #71729 (Possible crash in zend_bin_strtod, zend_oct_strtod,
|
||||||
zend_hex_strtod). (Laruence)
|
zend_hex_strtod). (Laruence)
|
||||||
. Fixed bug #71695 (Global variables are reserved before execution).
|
. Fixed bug #71695 (Global variables are reserved before execution).
|
||||||
|
27
Zend/tests/bug71756.phpt
Normal file
27
Zend/tests/bug71756.phpt
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
--TEST--
|
||||||
|
Bug #71756 (Call-by-reference widens scope to uninvolved functions when used in switch)
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
function a ($option) {
|
||||||
|
b($option['bla']);
|
||||||
|
c($option);
|
||||||
|
var_dump($option);
|
||||||
|
}
|
||||||
|
function b (&$string) {
|
||||||
|
$string = 'changed';
|
||||||
|
}
|
||||||
|
function c ($option) {
|
||||||
|
switch ($option['bla']) {
|
||||||
|
case 'changed':
|
||||||
|
$copy = $option;
|
||||||
|
$copy['bla'] = 'copy';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
a(array('bla' => 'false'));
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
array(1) {
|
||||||
|
["bla"]=>
|
||||||
|
string(7) "changed"
|
||||||
|
}
|
@ -1562,6 +1562,9 @@ num_index:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (type == BP_VAR_R) {
|
||||||
|
ZVAL_DEREF(retval);
|
||||||
|
}
|
||||||
} else if (EXPECTED(Z_TYPE_P(dim) == IS_STRING)) {
|
} else if (EXPECTED(Z_TYPE_P(dim) == IS_STRING)) {
|
||||||
offset_key = Z_STR_P(dim);
|
offset_key = Z_STR_P(dim);
|
||||||
if (dim_type != IS_CONST) {
|
if (dim_type != IS_CONST) {
|
||||||
@ -1593,6 +1596,9 @@ str_index:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (type == BP_VAR_R) {
|
||||||
|
ZVAL_DEREF(retval);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case BP_VAR_R:
|
case BP_VAR_R:
|
||||||
|
Loading…
Reference in New Issue
Block a user