[php-src] Issue #20377: Final property promotion not used without visibility

From: Date: Mon, 03 Nov 2025 17:35:32 +0000
Subject: [php-src] Issue #20377: Final property promotion not used without visibility
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-251170@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/20377 Author: DanielEScherzer ### Description The following code: ```php <?php class Demo { public function __construct( final string $foo, final public string $bar, ) {} } $d = new Demo("first", "second"); var_dump($d); ``` Resulted in this output: ``` object(Demo)#1 (1) { ["foo"]=> uninitialized(string) ["bar"]=> string(6) "second" } ``` But I expected this output instead: ``` object(Demo)#1 (1) { ["foo"]=> string(5) "first" ["bar"]=> string(6) "second" } ``` Looks like I didn't implement #17861 properly - the property is recognized as final, but is not initialized ### PHP Version ```plain 8.5+ ``` ### Operating System _No response_

« previous php.bugs (#251170) next »