mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00

Create new sub directories for tests related to backtraces and for tests related to `$this` being reserved in different places and not being usable or reassignable. Work towards GH-15631
25 lines
361 B
PHP
25 lines
361 B
PHP
--TEST--
|
|
Function default argument is not cached when its evaluation had side effects
|
|
--FILE--
|
|
<?php
|
|
|
|
class Foo {
|
|
public function __toString() {
|
|
static $i = 0;
|
|
return (string) $i++;
|
|
}
|
|
}
|
|
|
|
function test(string $foo = new Foo() . '') {
|
|
var_dump($foo);
|
|
}
|
|
|
|
test();
|
|
test();
|
|
test();
|
|
|
|
?>
|
|
--EXPECT--
|
|
string(1) "0"
|
|
string(1) "1"
|
|
string(1) "2"
|