3
Quote:
Notice [PHP]: Only variables should be assigned by reference in file include/common.php line 215
These are slowly getting cleaned up, but I see them and usually fix them throughout XOOPS core code - and some modules
The problem, is more pronounced as you move to PHP5.x versions.
The problem, if you want to learn programming, is that each of the notices is referring to the way the function is returning the assigned value. In this case, there is no assigned value, only a result.
For instance if I have a return like this
return new SomeFunction();
I will see the message similar to yours.
If I change it to
$someReturn = new SomeFunction();
return $someReturn;
The message goes away.
The first example is coder laziness. Not saying anything about the coder, I've done it myself! However, at the assembled code level, you are telling and assuming that the resultant code will create a slot that is going to be globally accessible to the code receiving the returned value. In other words, if a reserved place is not created (the variable $someReturn), I am not assured that the returned value won't get stomped on in memory. With Web applications, this is not too big a deal. In large scale system applications, this form of coding could bite you pretty hard.