1. 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"

Discussion in 'General PHP and MySQL Discussions' started by LPH, Nov 23, 2013.

  1. LPH

    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.

    // 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.
  2. LPH

    LPH Well-Known Member

    This is another place this code is tossing a strict standards message:

    if( $threadModel->canReplyToThread($thread, $forum, $errorKey = '') )
  3. LPH

    LPH Well-Known Member

    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? :)
  4. digitalpoint

    digitalpoint Well-Known Member

    You just need to remove this:
    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.
    LPH likes this.
  5. LPH

    LPH Well-Known Member

Share This Page