php 4.0.2 and args in a function
| From: | scottrus at ipass dot net | Date: | Fri, 01 Sep 2000 09:52:30 +0000 |
| Subject: | php 4.0.2 and args in a function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-14857@lists.php.net to get a copy of this message | ||
All -
I noticed some 'new behavior' with the release of php 4.0.2 and I'm not
sure if it's intended behavior or if it's just my coding style. Here's a
small sample script I wrote to demo the problem:
00 <?
01 function smoosh($var1, $var2) {
02 return $var1 . $var2;
03 }
04 ?>
05 <HTML>
06 <BODY>
07 <?
09 $onevar = smoosh("string1a","string2a");
10 print("<P>".$onevar);
11 $twovar = smoosh("string1b");
12 print("<P>".$twovar);
13 ?>
14 </BODY>
15 </HTML>
And the output:
00 string1astring2a
01 Warning: Missing argument 2 for smoosh() in
/home/httpd/html/testpage.html on line 2
03
04 string1b
If I pass my sample function only one of the two vars it expects I
generate the error shown on line 01 of my output. Under version 4.0.0 and
prior I did not see this behavior.
The 4.0.2 version of php I used came from the Red Hat 7.0 beta. I used the
src.rpm file to rebuild the packages on my Red Hat 6.2 box and installed
them with rpm. The install was smooth and aside from having to tweak the
rpm spec file a bit to account for the differences between 7.0 and 6.2 no
major errors occurred.
Is there a specific php option I should check for that would generate
these type of warnings?
Thanks for the help.
--
Scott