• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

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

LPH

Well-known member
#1
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.
 

LPH

Well-known member
#2
This is another place this code is tossing a strict standards message:

Code:
if( $threadModel->canReplyToThread($thread, $forum, $errorKey = '') )
 

LPH

Well-known member
#3
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? :)
 

digitalpoint

Well-known member
#4
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.