#39808 [NEW]: null does not set default in function
| From: | david at 1st-affiliation dot com | Date: | Tue, 12 Dec 2006 20:52:21 +0000 |
| Subject: | #39808 [NEW]: null does not set default in function | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-106270@lists.php.net to get a copy of this message | ||
From: david at 1st-affiliation dot com
Operating system: fedora core 4
PHP version: 5.2.0
PHP Bug Type: Scripting Engine problem
Bug description: null does not set default in function
Description:
------------
Hi
Since I upgrade the php version, the comportement of the function default
argument as change.
Previously, when I set a parameter to "null" the function use the default
value of the parameter.
Now it kept the null value, and I do not find a another way to set the
default value.
See the code for more information
Reproduce code:
---------------
<?php
function eat ($what='apple') {
print 'I eat '.$what;
}
eat(null);
?>
Expected result:
----------------
I eat apple
Actual result:
--------------
I eat
--
Edit bug report at http://bugs.php.net/?id=39808&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39808&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39808&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39808&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39808&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=39808&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39808&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39808&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39808&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39808&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39808&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=39808&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=39808&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39808&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39808&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39808&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39808&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39808&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39808&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39808&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39808&r=mysqlcfg