#47738 [Opn->Bgs]: passing empty array to a function with a null-default argument results in null

From: Date: Fri, 20 Mar 2009 23:04:46 +0000
Subject: #47738 [Opn->Bgs]: passing empty array to a function with a null-default argument results in null
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-134958@lists.php.net to get a copy of this message
 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)

« previous php.bugs (#134958) next »