Support » Plugin: Slimstat Analytics » PHP Warning: stripos() expects parameter 1 to be string, array given

  • Resolved txyoji

    (@txyoji)


    After an upgrade to slimstat 2.8.3 and wordpress 3.4.2, I get the following warnings:
    [22-Oct-2012 15:33:23] PHP Warning: stripos() expects parameter 1 to be string, array given in ./wp-content/plugins/wp-slimstat/wp-slimstat.php on line 68
    and
    [22-Oct-2012 15:41:26] PHP Warning: stripos() expects parameter 1 to be string, array given in ./wp-content/plugins/wp-slimstat/wp-slimstat.php on line 125

    In “/wp-content/plugins/wp-slimstat/wp-slimstat.php”
    Line 68, self::$options[‘ignore_users’] is an array, not a string.
    I fixed it with impode(‘,’,self::$options[‘ignore_users’]).

    Ditto for self::$options[‘ignore_countries’] at line 125.

    I’m not sure why the output type changed from what you were expecting but its pretty easy to work around.

    http://wordpress.org/extend/plugins/wp-slimstat/

Viewing 15 replies - 1 through 15 (of 19 total)
  • My two issues seem to be related. Now that I’ve added some missing tables, I’m getting a different error from implode about the return value not being a string.

    It appears that self::$options[”] is a string if the value exists and an empty array if it does not. An additional check before accessing these two variables will prevent the warnings.

    If the array only happens on an error condition:

    if(is_array(self::$options['ignore_countries'])){
      self::$options['ignore_countries'] = '';
     }

    The safer option would be:

    if(is_array(self::$options['ignore_countries'])){
      $tmpIgnoreContries = implode(',',self::$options['ignore_countries']);
     }else{
      $tmpIgnoreContries = self::$options['ignore_countries'];
    }
    if (stripos( $tmpIgnoreContries, $stat['country']) !== false) return $_argument;

    Plugin Author Jason Crouse

    (@coolmann)

    This has been fixed in 2.8.4.

    thescarletfire

    (@thescarletfire)

    Hello,

    I have a similar error, but it’s still present in v2.8.4

    Can you help please?

    Thanks!
    (I made a new thread)

    Plugin Author Jason Crouse

    (@coolmann)

    Can you try to manually download and install WP SlimStat 2.8.4 again? I spotted the error when it was too late, and now I fixed it in the repository.

    Thank you,
    Camu

    thescarletfire

    (@thescarletfire)

    I try to install it but it fails, saying a directory already exists.

    Do I really have to delete all my SlimStat data and start again with this upload of v2.8.4 manually?

    Plugin Author Jason Crouse

    (@coolmann)

    No no, just download the file from here:

    http://downloads.wordpress.org/plugin/wp-slimstat.latest-stable.zip

    unzip it and upload it to your server via FTP, overwriting the existing files. DO NOT UNINSTALL IT, or you will lose all your data. Just overwrite the files.

    Please let me know if you have questions,
    Camu

    thescarletfire

    (@thescarletfire)

    I have uploaded / replaced all files via FTP like you said, and the error persists.

    Warning: stripos() expects parameter 1 to be string, array given in /home/admin/public_html/wp-content/plugins/wp-slimstat/wp-slimstat.php on line 68

    Why is this happening, and what should I do now? This is not resolved at the moment…

    Thanks

    Plugin Author Jason Crouse

    (@coolmann)

    Then it must be something in your settings. Can you try deactivating and then reactivating Wp SlimStat?

    Plugin Author Jason Crouse

    (@coolmann)

    Okay, I found the bug, so sorry it happened to you. It will be fixed in the next version, which will be released on Monday. If you want to test it now, contact me and I’ll send it to you.

    la buca delle lettere

    Thanks,
    Camu

    thescarletfire

    (@thescarletfire)

    Hi friend!

    No worries, I understand. Sometimes bugs occur. 🙂 I can wait until Monday – no rush – thanks!

    But please do let me know when you upload the fixed bug-free version.

    Thanks again!

    Plugin Author Jason Crouse

    (@coolmann)

    You will get a message in your admin telling you that a new version is available 🙂

    Camu

    PS: a vote for my plugin would be a nice way to say thank you!

    d5f7p9

    (@d5f7p9)

    I am seeing the same error message as above since installing version 2.8.4 this morning. However the error message I see lists line 118 rather than the 2 lines mentioned above. Is your promised Monday update going to address the line 118 error message also?

    Plugin Author Jason Crouse

    (@coolmann)

    Yes, it will fix that too, which is related to the other ones. A temporary workaround is to go to the settings page and wherever you see ARRAY as the option value in one of the fields, just remove that word and save.

    massimo

    (@massimo_)

    hi camu, same error on my site (only in articles list in dashboard), resolved by the workaround in wp-slimstat’s settings.
    but before that I found out the update to 2.8.4 deleted all the statistics except for the current month, even if the wpslimstat database looks still “fat” (9.52MB). no way of recovering the lost statistics?

    Plugin Author Jason Crouse

    (@coolmann)

    Hi Massimo,

    Old data is purged based on the corresponding value in the plugin’s settings page. Is yours set to 30 days? The update, per se, is not performing any clean-up.

    Camu

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘PHP Warning: stripos() expects parameter 1 to be string, array given’ is closed to new replies.