Get rid of "Strict Standards: Only variables should be passed by reference"

LPH

Well-known member
The development environment is now tossing a strict standards error after upgrading to PHP 5.4 in ZendServer, XF 1.2.3, WordPress 3.8 beta-1, and the plugin I'm re-writing.

Code:
// Strict Standards: Only variables should be passed by reference happens here
  
   if($forumModel->canPostThreadInForum($forum, $errorPhraseKey = '')) {

How can the array be rewritten? Stackoverflow threads discuss defining an intermediate variable. I've tried a few ways but then end up with a call-time by reference error, and few others (depending on my attempts).

Thank you for any advice.
 
This is another place this code is tossing a strict standards message:

Code:
if( $threadModel->canReplyToThread($thread, $forum, $errorKey = '') )
 
I looked around and saw most posts did not include the $errorKey. Removed that part (since it was the cause of the message) and things appear to work.

So - my question becomes - what does that errorKey do? :)
 
You just need to remove this:
PHP:
= ''

Don't try to define the variable it when you call the method.

As far as what it's for, it will contain an error if there is one.
 
  • Like
Reactions: LPH
Back
Top Bottom