Re: PHP4 to PHP5 migration with E_STRICT
| From: | Tom Robinson | Date: | Wed, 08 Dec 2010 01:12:03 +0000 |
| Subject: | Re: PHP4 to PHP5 migration with E_STRICT | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-309903@lists.php.net to get a copy of this message | ||
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