Bug #66905 [Opn->Csd]: Unable to call after literal array dereference

From: Date: Tue, 07 Oct 2014 14:20:44 +0000
Subject: Bug #66905 [Opn->Csd]: Unable to call after literal array dereference
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187919@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66905&edit=1 ID: 66905 Updated by: nikic@php.net Reported by: vovan-ve at yandex dot ru Summary: Unable to call after literal array dereference -Status: Open +Status: Closed Type: Bug Package: Scripting Engine problem PHP Version: 5.5.10 -Assigned To: +Assigned To: nikic Block user comment: N Private report: N New Comment: Fixed in PHP 7. Previous Comments: ------------------------------------------------------------------------ [2014-03-14 11:12:14] vovan-ve at yandex dot ru Description: ------------ PHP 5.4 allows us to make a call after array dereference: $a = [function () { return 42; }]; var_dump( $a[0]() ); // int(42) PHP 5.5 allows us to dereferende literal array even: var_dump([42][0]); // int(42) But combination of this features cause a syntax error. Test in a sandbox: http://3v4l.org/1CHXs Test script: --------------- var_dump([function () { return 42; }][0]()); Expected result: ---------------- int(42) Actual result: -------------- Parse error: syntax error, unexpected '(' in ... ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66905&edit=1

« previous php.bugs (#187919) next »