php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66905 Unable to call after literal array dereference
Submitted: 2014-03-14 11:12 UTC Modified: 2014-10-07 14:20 UTC
From: vovan-ve at yandex dot ru Assigned: nikic (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.5.10 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: vovan-ve at yandex dot ru
New email:
PHP Version: OS:

 

 [2014-03-14 11:12 UTC] 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 ...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-10-07 14:20 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2014-10-07 14:20 UTC] nikic@php.net
Fixed in PHP 7.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 17:01:33 2024 UTC