php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #51672 Parse error when a subscript operator is used after a function call operator
Submitted: 2010-04-27 12:11 UTC Modified: 2012-03-05 09:08 UTC
From: miklcct at gmail dot com Assigned: stas (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3.2 OS: Ubuntu 9.04
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: miklcct at gmail dot com
New email:
PHP Version: OS:

 

 [2010-04-27 12:11 UTC] miklcct at gmail dot com
Description:
------------
syntax error when a subscript operator is used with a function call operator

Test script:
---------------
#!/usr/bin/php

<?php
function test() {
        return "foo";
}

echo test()[0];


Expected result:
----------------
f


Actual result:
--------------
Parse error: syntax error, unexpected '[', expecting ',' or ';' in /home/www/bus/test.php on line 8


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-27 12:14 UTC] degeberg@php.net
-Status: Open +Status: Bogus
 [2010-04-27 12:14 UTC] degeberg@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 [2011-08-26 09:56 UTC] nmn at mailinator dot com
Not a bug, just a stupid feature that demonstrate the lack of vision in the language design.
 [2012-03-05 09:07 UTC] stas@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php

This syntax is now part of PHP 5.4.
 [2012-03-05 09:07 UTC] stas@php.net
-Status: Not a bug +Status: Closed -Assigned To: +Assigned To: stas
 [2012-03-05 09:08 UTC] stas@php.net
-Type: Bug +Type: Feature/Change Request -Package: Compile Failure +Package: Scripting Engine problem
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 14:01:30 2024 UTC