Re: PHP4 to PHP5 migration with E_STRICT

From: Date: Wed, 08 Dec 2010 00:37:43 +0000
Subject: Re: PHP4 to PHP5 migration with E_STRICT
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-309901@lists.php.net to get a copy of this message
In getCategoryTypes() you're assigning a reference to the return value of getContentTypes(), and PHP doesn't like that. You can return a reference to a variable from a function, but taking the reference of a *value* is meaningless since you can only create references to variables. Just remove the & on that marked line to get rid of the warning. Also, I notice that both of those methods (and I assume many more) take a reference in $db. Note that all objects are assigned by reference in PHP 5, and thus the & here is unnecessary since you are passing an object to these methods and aren't changing the reference inside the method. Note that PHP won't issue a warning for these since it is acceptable and you might want to point the reference to a new object inside the function. You aren't doing that here, so the & is superfluous and misleading. David

« previous php.general (#309901) next »