Bug #78993 [Com]: Ellipsis inconsistency

From: Date: Thu, 19 Dec 2019 08:54:28 +0000
Subject: Bug #78993 [Com]: Ellipsis inconsistency
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224403@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78993&edit=1 ID: 78993 Comment by: imbolk at gmail dot com Reported by: imbolk at gmail dot com Summary: Ellipsis inconsistency Status: Not a bug Type: Bug Package: *General Issues Operating System: All PHP Version: 7.4.1 Block user comment: N Private report: N New Comment: What about var_dump(...($a));? ($a) is not expression? Previous Comments: ------------------------------------------------------------------------ [2019-12-19 08:01:40] requinix@php.net T_ELLIPSIS can only be used in an array or as a function argument. It unpacks an expression, and it is not an expression itself. ------------------------------------------------------------------------ [2019-12-19 07:35:53] imbolk at gmail dot com Description: ------------ It seems to me that there is an inconsistency in the PHP syntax associated with T_ELLIPSIS. Test script: --------------- $a = [[1,2,3], [4,5,6]]; var_dump(...($a)); var_dump(...(...($a))); Expected result: ---------------- array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } array(3) { [0]=> int(4) [1]=> int(5) [2]=> int(6) } array(6) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(4) [4]=> int(5) [5]=> int(6) } Actual result: -------------- array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } array(3) { [0]=> int(4) [1]=> int(5) [2]=> int(6) } PHP Parse error: syntax error, unexpected '...' (T_ELLIPSIS) in Command line code on line… ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78993&edit=1

« previous php.bugs (#224403) next »