

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.

There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.
0 million dollars have been spent by Washington.
0.00 dollars per person.
And that is only Federal spending...
0 babies have died worldwide in an abortion.
0 babies were in the United States.
0 Americans have contracted an STD.
Weird.
And they even bothered to put an '&' in front of it. lol. I don't get it either.
Probably a Typo
A couple other things make this doubly weird. This is the main function call for the project. The variable that they pass is the equivalent of my calling test($hello). I only used test($world) in the example above to demonstrate what is happening to the variable.
A programmer was probably debugging and got distracted (I hope
). The PHP behavior wasn't exactly what I expected since the variable was passed by reference. Instead two copies of the variable were made available, with the global one taking precedence.
This looks like php4 code,
This looks like php4 code, imho. Of course, it's simplified. But explicitly passing by reference is no longer necessary in most cases in php >= 5.0.