Bug #13892 Updated: too many number of parameters

From: Date: Mon, 05 Nov 2001 00:38:18 +0000
Subject: Bug #13892 Updated: too many number of parameters
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-69620@lists.php.net to get a copy of this message
ID: 13892
User updated by: yasuo_ohgaki@yahoo.com
Reported By: yasuo_ohgaki@yahoo.com
Status: Open
Bug Type: Feature/Change Request
Operating System: any
Old PHP Version: 4.0.6
PHP Version: Zend Engine 2
New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[2001-11-04 16:06:36] sander@php.net

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-10-31 19:09:46] yasuo_ohgaki@yahoo.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.

------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=13892&edit=1



Thread (5 messages)

« previous php.dev (#69620) next »