[php-src] Issue #8959: `static $var = xxx` should support any expression

From: Date: Sat, 09 Jul 2022 10:11:12 +0000
Subject: [php-src] Issue #8959: `static $var = xxx` should support any expression
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241887@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8959 Author: mvorisek ### Description https://3v4l.org/hsMgb ``` <?php class Cl { public function scalar(): void { static $counter = 0; } public function obj(): void { static $counter = new class() {}; } } ``` Currently php emits fatal error for static $var = new class() {};. But static $var = ...; should support any expression like if the assign op would not be prefixed with static as such prefix only defines the statement should be evaluated only once per php request lifecycle.

« previous php.bugs (#241887) next »