php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #36991 Passing illegal parameter to function should generate WARNING
Submitted: 2006-04-06 00:08 UTC Modified: 2006-04-06 06:20 UTC
From: gk at proliberty dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.1.2 OS: Red Hat Linux 9
Private report: No CVE-ID: None
 [2006-04-06 00:08 UTC] gk at proliberty dot com
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-06 06:20 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This is there so that you can use func_get_args() and friends.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 13:01:29 2024 UTC