Re: PHP4 to PHP5 migration with E_STRICT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8 December 2010 01:12, Tom Robinson <tom.robinson@xxxxxxxxxxxx> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux