[Phpmyadmin-devel] a PHP 5.1.2 bug?

Garvin Hicking phpmyadmin at supergarv.de
Fri Jan 13 03:46:05 CET 2006


> why?
> function myFunction(&$param) {}
> myFunction($param = true);
> this gives the reference $param to the function, there is no reason why this
> should not work! true is assigned to $param and than $param is passed by
> reference to the function.

Did you test this with PHP 5.1.2?

Please ask on bugs.php.net then for this, but I am quite sure that if it does
not work, it's because of the reasons I outlined. Passing assignment values to a
function as a REFERENCE variable is methodically problematic, because the parser
should/would expect a plain variable there.

> yes of course, but it doesn't passes a function, it passes a variable!

That depends on the mechanism of the ZEND Parser and Tokenizer, what is
evaluated and passed...so this behaviour might have well been changed in recent
PHP5. That's all I'm trying to say. :-)

> yes of course thats why variables names are descriptive
> sort_array($my_array);
> everything is clear, but
> db_close(true, false);
> is obfuscated!
> so i would prefer
> db_close($clean_cache = true, $unset_global_link_variable = false);

But this style is actually very rarely used in what I've seen so far, and
usually it's up to the IDE  (like eclipse)  to show you the function parameters
for a function call. The way of calling it like above is a larger parsing
overhead plus a larger code signature plus more memory usage for variable

> whatever, i still think this is a php bug!

That's not for me to decide, I just tried to point out that such function calls
are a bit weird. ;-)

Best regards,

++ Garvin Hicking | Web-Entwickler [PHP]    | www.garv.in | ICQ 21392242
++ Developer of   | www.phpMyAdmin.net      | www.s9y.org

++ Make me happy  | http://wishes.garv.in

More information about the Developers mailing list