[php-src] Issue #8383: Enums can't be initialized in the constructor

From: Date: Sat, 16 Apr 2022 08:54:01 +0000
Subject: [php-src] Issue #8383: Enums can't be initialized in the constructor
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241025@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8383 Author: avierr ### Description I have the following code: ``` <?php enum TKind { case TK_PUNCT; case TK_NUM; case TK_EOF; } class A{ public TKind $kind; public function __constructor($kindArg){ $this->kind = $kindArg; } } $a = new A(Tkind::TK_PUNCT); var_dump($a); ``` I am expecting $a->kind to be initialized, yet the output looks like the following, ``` object(A)#1 (0) { ["kind"]=> uninitialized(TKind) } ``` Demo: https://3v4l.org/18V1r#v8.1.5 ### PHP Version 8.1.5 ### Operating System _No response_

« previous php.bugs (#241025) next »