|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #13892 too many number of parameters
Submitted: 2001-10-31 19:09 UTC Modified: 2010-11-18 12:38 UTC
Avg. Score:3.7 ± 1.6
Reproduced:14 of 15 (93.3%)
Same Version:5 (35.7%)
Same OS:11 (78.6%)
From: yasuo_ohgaki at yahoo dot com Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: Zend Engine 2 OS: any
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: yasuo_ohgaki at yahoo dot com
New email:
PHP Version: OS:


 [2001-10-31 19:09 UTC] yasuo_ohgaki at yahoo dot com
Currently, it seems PHP is designed NOT to report errors for too many paramaters for user defined functions.

"..." for variable length paramters. Raise error without "...", for example.

function foo($var1, $var2, ...)

assert(count(function_get_args()) <= 3);
or like can be used to check num of paramters, but module functions checks num of parameters. User functions are better to behave the same way by default. IMHO.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-04 16:06 UTC]
Changing this would break a lot of scripts.
And what's wrong with specifying too many parameters? If you don't use them explicitly, they don't influence the function, so why care about them?
 [2001-11-04 19:38 UTC] yasuo_ohgaki at yahoo dot com
I know it may break a lot of scripts that has written poorly. I'm not suggesting to change the behavior immediately, without a ini entry or build option. :) 

Without proper variable length parameters handling, too many parameters for a function is obvious programming mistake. This behaviour is inconsistent with functions defined by modules also. 

Zend is better to have option to warn, if caller called a user defined functions with too many arguments. IMHO. 
However PHP is scripting language, adding too many features to language is not good idea. Just a suggestion.

 [2001-11-05 03:48 UTC]
I think current behaviour is fine, Module functions dont have to check how many arguments they have, they can if they want but there are some that dont for various reasons.

The current situation seems to work ok and there is no reason why passing extra arguments is an error as they dont effect the running of the program.

- James
 [2001-11-05 10:44 UTC]
I'm also unhappy with the current behavior. It's a source of hard to find bugs, and, IMO, not a very useful feature. PHP has provisions for handling varargs, so why not stick with them? 
 [2010-11-18 12:38 UTC]
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: Scripting Engine problem
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 29 18:01:34 2024 UTC