phpwordpressopensocial

Wordpress Open Social Error:"Strict Standards: Only variables should be passed by reference"


I am using the Open Social Plugin in Wordpress. I also installed the Debug Plugin to see what is going on. I get a PHP Error saying:

Strict Standards: Only variables should be passed by reference in /wp-content/plugins/open-social/open-social.php on line 111.

Line 111 in open-social.php:

'google'=>"http://translate.google.com.hk/translate?hl=".(isset($_SESSION['WPLANG_LOCALE'])?$_SESSION['WPLANG_LOCALE']:'en_US')."&sl=zh-CN&tl=".(isset($_SESSION['WPLANG_LOCALE'])?reset(str_split($_SESSION['WPLANG_LOCALE'],2)):'en')."&u=%URL%"

Does anyone know what is wrong with this line? I am stuck here.


Solution

  • Your problem is this:

    reset(str_split($_SESSION['WPLANG_LOCALE'],2))
    

    You are trying to reset the return value of str_split; you can only reset a variable, not an expression value. See the docs for reset, which show that it is declared as mixed reset (array &$array).

    It's not 100% clear to me what you are trying to do with reset here. I suspect you just want the str_split value, in which case you don't need to reset anything.