WordPress.org

Ready to get started?Download WordPress

Forums

WP SlimStat
[resolved] PHP Warning: stripos() expects parameter 1 to be string, array given (20 posts)

  1. txyoji
    Member
    Posted 1 year ago #

    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/

  2. txyoji
    Member
    Posted 1 year ago #

    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;
  3. camu
    Member
    Plugin Author

    Posted 1 year ago #

    This has been fixed in 2.8.4.

  4. thescarletfire
    Member
    Posted 1 year ago #

    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)

  5. camu
    Member
    Plugin Author

    Posted 1 year ago #

    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

  6. thescarletfire
    Member
    Posted 1 year ago #

    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?

  7. camu
    Member
    Plugin Author

    Posted 1 year ago #

    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

  8. thescarletfire
    Member
    Posted 1 year ago #

    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

  9. camu
    Member
    Plugin Author

    Posted 1 year ago #

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

  10. camu
    Member
    Plugin Author

    Posted 1 year ago #

    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.

    http://www.duechiacchiere.it/contatto

    Thanks,
    Camu

  11. thescarletfire
    Member
    Posted 1 year ago #

    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!

  12. camu
    Member
    Plugin Author

    Posted 1 year ago #

    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!

  13. d5f7p9
    Member
    Posted 1 year ago #

    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?

  14. camu
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  15. massimo
    Member
    Posted 1 year ago #

    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?

  16. camu
    Member
    Plugin Author

    Posted 1 year ago #

    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

  17. massimo
    Member
    Posted 1 year ago #

    automatic purge is set to 0 (zero)... I'm looking into the slim_stats sql table and, even if I'm not very addicted to mysql, it looks there're all my stats. just i cannot see them in the wp-slimstat info panel!

  18. camu
    Member
    Plugin Author

    Posted 1 year ago #

    By default Wp SliStat shows you this month's stats :)

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

  19. massimo
    Member
    Posted 1 year ago #

    hehe you are right but your plugin is already a fav :D thanks for it and for supporting us! ;-)

    but... have you modified the default settings in your last update? I also remember that the panel "Informazioni su WP Slim Stat" normally showed the number of total accesses (from 7.2.2011 for my site), DB dimension, tracking status etc, while the "Panoramica" panel shows monthly and daily stats. Now I see a duplicated information: the total accesses and the 11/2012 accesses are the same; other values are still right.
    I've already disabled/re-enabled and re-uploaded via FTP the plugin with no success.

  20. camu
    Member
    Plugin Author

    Posted 1 year ago #

    Yes, that is a bug, I spotted it after I had already released this last version. It has already been fixed in 2.8.5, if you want to test it, send me a message at

    http://www.duechiacchiere.it/contatto

    and I'll send it to you.

    Cheers,
    Camu

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic