#47738 [Opn->Bgs]: passing empty array to a function with a null-default argument results in null
ID: 47738
Updated by: felipe@php.net
Reported By: alexanderpodgorny at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Mac OS X
PHP Version: 5.2.9
New Comment:
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
See the 'Loose comparisons with ==' table at
http://docs.php.net/manual/en/types.comparisons.php
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2009-03-20 22:47:42] alexanderpodgorny at yahoo dot com
Description:
------------
When passing empty arrays to a function using a parameter that defaults
to null, the default value is being passed instead of the array.
Reproduce code:
---------------
function test($value=null) {
if($value == null) {
print "null";
} else {
print "not null";
}
}
test(array());
Expected result:
----------------
"not null"
Actual result:
--------------
"null"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47738&edit=1
Thread (2 messages)