Re: prob. with function parameter with "&"

From: Date: Tue, 12 Aug 2003 22:01:01 +0000
Subject: Re: prob. with function parameter with "&"
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-159342@lists.php.net to get a copy of this message
* Thus wrote Mirek Novak (mirek.novak@auto.cz): > Hi everybody, > > I have defined function > > function func ($var,$val,&$struct){ > // do something > } > > if I call this function following way > > func('a','b',NULL); > > (because sometimes I don't need to set $struct) > apache process (php) crashes without saying word into log... > So, is it bug or feature. A bug. php shouldn't die if a NULL is passed, it should give an error as if you typed: func('a', 'b', 'c'); An error should complain about passing constant to reference. But, it is fixed with 4.3.3RC1. so no need to submit a bug on it: <?php function foo($a, $b, &$c) { } foo('a', 'b', NULL); ?> Results: Fatal error: Only variables can be passed by reference in /usr/home/www/domains/dyndns.org/web/zirzow/_/php/tests/bugs/func_ref_null.php on line 2 Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#159342) next »