1--TEST-- 2Function default argument is not cached when its evaluation had side effects 3--FILE-- 4<?php 5 6class Foo { 7 public function __toString() { 8 static $i = 0; 9 return (string) $i++; 10 } 11} 12 13function test(string $foo = new Foo() . '') { 14 var_dump($foo); 15} 16 17test(); 18test(); 19test(); 20 21?> 22--EXPECT-- 23string(1) "0" 24string(1) "1" 25string(1) "2" 26