Re: PHP4 to PHP5 migration with E_STRICT

From: Date: Wed, 08 Dec 2010 10:14:27 +0000
Subject: Re: PHP4 to PHP5 migration with E_STRICT
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-309906@lists.php.net to get a copy of this message
On 8 December 2010 01:12, Tom Robinson <tom.robinson@motec.com.au> wrote: > Thanks David. > > If my understanding is correct, then: > > SPControlPanel::getContentTypes($db); > > is a reference to a static instantiation of the class. If so, then it > must be syntactically something like when using 'new' (which returns a > reference) so there's no need to apply the & operator. Am I on the right > track? > > I have some more PHP4 code in the application which caused: "PHP > Notice:  Only variable references should be returned by reference". I > have fixed it like this: > > <       function & _getTable($cached=true) > <       { > <               return new TableClass($this->_getTableName()); > --- >>       function & _getTable($cached=true) { >>               $temp = new TableClass($this->_getTableName()); >>               return $temp; > > Is this acceptable? > > I'll have to come back to the $db issue - it's not issuing a warning so > I'll leave it alone until I've tidied up all the other issues. > > Regards, > > Tom I'd go with ... function _getTable($cached=true) { return new TableClass($this->_getTableName()); } -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

« previous php.general (#309906) next »