mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
d65d3f5298
Don't expose references in debug_backtrace() or exception traces. This is regardless of whether the argument is by-reference or not. As a side-effect of this change, exception traces may now acquire the interior value of a reference, which may be unexpected for some internal functions. This is what necessitated the change in the spl_array sort implementation.
22 lines
406 B
PHP
22 lines
406 B
PHP
--TEST--
|
|
Bug #79108: Referencing argument in a function makes it a reference in the stack trace
|
|
--FILE--
|
|
<?php
|
|
|
|
function test(string $val) {
|
|
$a = &$val;
|
|
hackingHere();
|
|
print_r($val);
|
|
}
|
|
|
|
function hackingHere() {
|
|
// we're able to modify the $val from here, even though the arg was not a reference
|
|
debug_backtrace()[1]['args'][0] = 'Modified';
|
|
}
|
|
|
|
test('Original');
|
|
|
|
?>
|
|
--EXPECT--
|
|
Original
|