php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5789 missing arguments
Submitted: 2000-07-26 03:42 UTC Modified: 2000-07-26 07:22 UTC
From: steeven at kali dot com dot cn Assigned:
Status: Closed Package: Other
PHP Version: 4.0.1pl2 OS: win98
Private report: No CVE-ID: None
 [2000-07-26 03:42 UTC] steeven at kali dot com dot cn
here is a short sample program:

<?php
test();
function test($a1){
 echo "test";
}
?>

and an warning is shown:
Warning: Missing argument 1 for test() in e:\apache\htdocs\bbs\test1.php on line 3
test

There is no problem when I use php4.0.0, anyone have the same problem?

win98+apache+php4.0.1pl2

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-26 07:22 UTC] rasmus@php.net
If 4.0.0 didn't complain, then either it was broken or you had your error reporting level set differently.  If you want a function to have an optional argument you have to set a default value.  ie.  function test($a1=0) { ... }
Now you can call just test() without an argument.

 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Nov 28 11:05:53 2022 UTC