I won’t incriminate this project’s coders, but they do sell their work that is based on vBulletin. One of their free projects contains a function that has three arguments passed to it. The first argument is immediately overwritten by a global. Here is a stripped down example:
<?php
$hello = 'hello';
$world = 'world';
function test(&$hello) {
global $hello;
echo "$hello\n";
}
test($world);
echo "$hello $world\n";
?>
And the output of my function:
$ php test.php
hello
hello world
$world
is passed by reference as $hello
. It is promptly ignored in favor of the global $hello
variable, without even overwriting $world
. They should remove the required parameter $hello
.