#23804 [WFx]: passing wrong parameter count to user functions gives no warnings
| From: | derick@php.net | Date: | Mon, 26 May 2003 09:11:45 +0000 |
| Subject: | #23804 [WFx]: passing wrong parameter count to user functions gives no warnings | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-40427@lists.php.net to get a copy of this message | ||
ID: 23804
Updated by: derick@php.net
Reported By: meebey@php.net
Status: Wont fix
Bug Type: Scripting Engine problem
Operating System: Debian GNU/Linux
PHP Version: 4.3.1
New Comment:
This can not be implemented because:
1. it breaks BC
2. it renders func_get_args() totally useles.
no warning, no nothing; it's fine as-is
Previous Comments:
------------------------------------------------------------------------
[2003-05-26 04:08:15] meebey@php.net
if not error than at least a warning... It's very confusing when APIs
in PHP programs change and after searching for hours, the problem is
found which is a function call with too much parameters. I always
exspected that PHP will give a warning like I get them with the C
functions.
Also it's bad programming, ignoring this kind of error is not good.
------------------------------------------------------------------------
[2003-05-25 21:30:40] sniper@php.net
There's nothing to fix here, more is broken if some error is added..
------------------------------------------------------------------------
[2003-05-25 17:32:48] meebey@php.net
I didn't say anything about calling an user function with a variable
parameter list, that is a completely different situation.
------------------------------------------------------------------------
[2003-05-25 17:22:48] b_ulrich at t-online dot de
I think this isn't a bug and there should be no warning.
Reason:
Users can define functions of variable number of parameters.
So you can define a function with no parameters like
function foo() { ...} and cal it with a different number of parameters
like foo($a,$b); foo($a,$b,$c,$d);
To handle them ther are functions like func_num_arg() or
func_get_args()
So warnings are wrong in that case.
------------------------------------------------------------------------
[2003-05-25 17:02:28] nicos@php.net
Reproduced with 4.3.2RC4 and PHP5.
I'm not sure if its a feature request or if its a bug but its true that
IMHO, it should raise an E_WARNING as ZEND_WRONG_PARAM_COUNT(); or at
least an E_NOTICE.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/23804
--
Edit this bug report at http://bugs.php.net/?id=23804&edit=1