Posted by Rasmus Lerdorf on 09/21/05 07:58
Vizion wrote:
> function &setupTemplate( $classname, $repository=false, $cache_dir=false ) {
> return new $classname();
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> }
Is that really all they have in that function? It seems rather useless
to me. Why call a function just to instantiate a class like that?
Regardless, here it is trying to create a reference to a temp var.
Basically PHP will ignore the reference here, and it should work, but
you are getting a notice because the reference is being discarded.
Either drop the reference from the function definition or do:
$class =& new $classname();
return $class;
And for PHP5 you can just drop all references related to objects and it
will do the right thing.
-Rasmus
[Back to original message]
|