From: none at space dot com
Operating system: any
PHP version: 4.3.6
PHP Bug Type: Documentation problem
Bug description: function arguments 'null' and staticval with n passing by reference
Description:
------------
proper reference documentation missing on how to switch from 'call-time
call-by-reference' to 'call-by-reference'.
with more and more ISP's upgrading php from versions prior the deprecated
'call-time call-by-reference' to newer versions, more and more people get
utterly frustrated searching solutions to fix their codes or libs for the
two situations below.
especially passing 'no object' or null to a class has become critical and
there is no clear statement in the documentation of (references explained)
on what logic the guys that deprecated the the 'call-time' functionality
had in mind to compensate for that lack of functionality.
i think it's about time you post the concept and solution of this change
somewhere prominently.
Reproduce code:
---------------
function foo (& $var){
if (is_null($var)){return 0};
return(1);
}
#call now
foo($somevar); #will work
foo(''); #will not work (how to do this properly?)
foo(1); #will not work (obviously)
Expected result:
----------------
>1
>0
>0
--
Edit bug report at http://bugs.php.net/?id=29018&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29018&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29018&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=29018&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=29018&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=29018&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=29018&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=29018&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=29018&r=support
Expected behavior: http://bugs.php.net/fix.php?id=29018&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=29018&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=29018&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=29018&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29018&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=29018&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=29018&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=29018&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29018&r=float