|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #64176 functions calls should accept trailing ,
Submitted: 2013-02-08 21:38 UTC Modified: 2021-02-08 14:18 UTC
Avg. Score:4.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: php at paulisageek dot com Assigned: cmb (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.4Git-2013-02-08 (Git) OS: All
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.
Block user comment
Status: Assign to:
Bug Type:
From: php at paulisageek dot com
New email:
PHP Version: OS:


 [2013-02-08 21:38 UTC] php at paulisageek dot com
In our code we require everyone to put a trailing , in array declarations so that 
blame stays clean. Like when:

$foo = array(


$foo = array(

Then only 1 line has changed. But for function calls, when

$foo = foo(


$foo = foo(

now 2 lines blame to you.

Allowing the same syntax for function calls as array creation would be great.

Test script:
function id($x) { return $x; }


Expected result:
It runs.

Actual result:
Fatal error: syntax error, unexpected ')'


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-21 05:36 UTC]
for the record, here comes a RFC by Sara:
 [2018-10-22 09:48 UTC] jean dot claveau at gmail dot com
Not only function calls could work this way for a smoother workflow, methods and functions definitions also :

function my_funtion($param1, $param2,)
    // ...

Especially with a lot of parameters :

function my_funtion(
) {
    // ...
 [2018-10-22 09:50 UTC] spam2 at rhsoft dot net
 [2021-02-08 14:18 UTC]
-Status: Open +Status: Closed -Package: Unknown/Other Function +Package: Scripting Engine problem -Assigned To: +Assigned To: cmb
 [2021-02-08 14:18 UTC]
Indeed, trailing commas in function calls are permissible as of
PHP 7.3.0[1].  There are also permissible in method and function
definitions as of PHP 8.0.0[2].

[1] <>
[2] <>
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Mar 04 07:01:26 2021 UTC