Chris Aitken [[EMAIL PROTECTED]] wrote:
> On Fri, 13 Apr 2001, Chris Aitken wrote:
> 
> >---------------------------------------
> >
> >Warning: Missing argument 2 for stripe() in /location/to/included/file.php on line 
>257
> >Warning: Missing argument 3 for stripe() in /location/to/included/file.php on line 
>257
> >
> >---------------------------------------
> >
> 
> Okay, ive managed to do some more playing, and come up with some more
> info.
> 
> The above error only shows up when I have a function being called without
> all the arguments filled in.  For example, if I have a function as
> "function blah($foo,$bar)" and call the function with both $foo and $bar
> set, it will run just fine. But if I call it with only $foo it comes up
> with these errors.
> 
> The thing is, the previous version of PHP must have alowed me to call
> functions without all the arguments and it never batted an eyelid or gave 
> an error.
> 
> My question is, is there something I didnt compile into the new PHP, or is
> there a line in php.ini file I need to modify so that it doesnt show these
> errors up (or should I adjust my code so that I dont call functions
> without all the arguments) ?

I found the same problem - when we upgraded to PHP4, function calls
that used to work and NOT provide all the parameters, started failing.

The way I fixed it was to give each parameter a default value *IN*
the function definition, like:

function abc($a='', $b='') // assigns null as parameter defaults

that way, every parameter gets a value, even if all the parameters
were not supplied in the call.

HTH.

-- 
Hardy Merrill
Mission Critical Linux, Inc.
http://www.missioncriticallinux.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to