#36991 [NEW]: Passing illegal parameter to function should generate WARNING
| From: | gk at proliberty dot com | Date: | Thu, 06 Apr 2006 00:08:53 +0000 |
| Subject: | #36991 [NEW]: Passing illegal parameter to function should generate WARNING | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-95371@lists.php.net to get a copy of this message | ||
From: gk at proliberty dot com
Operating system: Red Hat Linux 9
PHP version: 5.1.2
PHP Bug Type: Feature/Change Request
Bug description: Passing illegal parameter to function should generate WARNING
Description:
------------
When you pass an illegal parameter to a function - i.e., a parameter not
specified in the function declaration - php should issue a WARNING, or at
least a NOTICE, error message.
This type of error-checking should be analagous to the WARNING which IS
issued when a required parameter is NOT included in a function call. See
example below.
Reproduce code:
---------------
<?php
error_reporting(E_ALL | E_STRICT);
function foo(){}
foo(true);
function bar($bar){}
bar();
/*
OUTPUT:
Warning: Missing argument 1 for bar() in
/usr/local/apache/htdocs/test/test.php on line 7
EXPECTED OUTPUT:
Warning: Illegal argument 1 for foo() in
/usr/local/apache/htdocs/test/test.php on line 4
Warning: Missing argument 1 for bar() in
/usr/local/apache/htdocs/test/test.php on line 7
*/
?>
Expected result:
----------------
Warning: Illegal argument 1 for foo() in
/usr/local/apache/htdocs/test/test.php on line 4
Warning: Missing argument 1 for bar() in
/usr/local/apache/htdocs/test/test.php on line 7
Actual result:
--------------
Warning: Missing argument 1 for bar() in
/usr/local/apache/htdocs/test/test.php on line 7
--
Edit bug report at http://bugs.php.net/?id=36991&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36991&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36991&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36991&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36991&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=36991&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36991&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36991&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36991&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36991&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36991&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=36991&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=36991&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36991&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36991&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36991&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36991&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36991&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36991&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36991&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36991&r=mysqlcfg