[php-src] Issue #9769: Misleading error message for array unpacking of objects/enums in constant expression

From: Date: Tue, 18 Oct 2022 00:40:31 +0000
Subject: [php-src] Issue #9769: Misleading error message for array unpacking of objects/enums in constant expression
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242621@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/9769 Author: TysonAndre ### Description The following code: ```php <?php const EXAMPLE = [...new ArrayObject()]; ``` Resulted in this output: ``` Warning: Uncaught Error: Only arrays and Traversables can be unpacked in ... ``` But I expected this output (something along these lines) instead: ``` Warning: Uncaught Error: Cannot unpack Traversables in constant expression in ... ``` This should be improved in php 8.3 ### PHP Version 8.1+ ### Operating System _No response_

« previous php.bugs (#242621) next »