1
0
mirror of https://github.com/php/php-src.git synced 2026-03-25 08:42:29 +01:00
Files
archived-php-src/ext/standard/tests/array/bug79839.phpt
Nikita Popov d65d3f5298 Fix bug #79108
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.
2020-07-24 12:23:34 +02:00

27 lines
444 B
PHP

--TEST--
Bug #79839: array_walk() does not respect property types
--FILE--
<?php
class Test {
public int $prop = 42;
}
$test = new Test;
try {
array_walk($test, function(&$ref) {
$ref = []; // Should throw
});
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
var_dump($test);
?>
--EXPECT--
Cannot assign array to reference held by property Test::$prop of type int
object(Test)#1 (1) {
["prop"]=>
int(42)
}