Re: Wikimedia - php4
| From: | Rasmus Lerdorf | Date: | Wed, 21 Sep 2005 04:58:47 +0000 |
| Subject: | Re: Wikimedia - php4 | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-222845@lists.php.net to get a copy of this message | ||
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