WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] wp-stats plugin v. 1.2 Fatal error stats.php on line 548 (12 posts)

  1. raymer
    Member
    Posted 6 years ago #

    I'm getting an error on my dashboard using wp-stats plugin version 1.2 on new wp 2.5. The double wide widget shows the graph on the left just fine but does not show the top posts on the right - only the followin error:
    Fatal error: Only variables can be passed by reference ... in <path>stats.php on line 548

    I checked my install (I use svn). I even deleted the wp-includes and wp-admin dirs and redownloaded the files. Didn't help. I have another site on the same webhost and the plugin works fine so I don't think its a PHP version thing - weird I can't figure it out.

    Any ideas?

    Thanks,
    Ray

  2. relaxedg
    Member
    Posted 6 years ago #

    me too

  3. frasten
    Member
    Posted 6 years ago #

    Hi, i looked at the code, and this could happen when you have a corrupted stats cache.
    To fix it you have to manually execute (via phpMyAdmin or similar) this query, in your WordPress database:
    DELETE FROM wp_options WHERE option_name = 'stats_cache'

    Next time you reload the page, the cache will be re-created and it should work as expected.

  4. raymer
    Member
    Posted 6 years ago #

    Frasten,
    Bingo! That worked. Thanks a lot.

    Can you bring this to the developers' attention? Any way they could make the plugin more robust in this regard?

    Ray

  5. frasten
    Member
    Posted 6 years ago #

    Great!
    I mailed the authors about this, and proposed a fix to avoid this issue.

  6. raymer
    Member
    Posted 6 years ago #

    A little further information -- after a few days I went into the plugin options and changed the stats options from days to months to weeks etc. Trying to see which options were best and bam! the same error appeared. So somehow changing the options on the plugin has caused database corruption??? Will your proposed fix help that?

    Regards,
    Ray

  7. frasten
    Member
    Posted 6 years ago #

    Yes, it should, because it erases the cache whenever it is invalid.
    The fix is this:
    Edit the file stats.php, and change line 543:

    if ( !$stats_cache = get_option( 'stats_cache' ) )
          $stats_cache = array();

    to:

    $stats_cache = get_option( 'stats_cache' );
        if ( !$stats_cache || !is_array( $stats_cache ) )
          $stats_cache = array();
  8. raymer
    Member
    Posted 6 years ago #

    Thanks. That seems to have done the trick. I appreciate your help!
    props.

    FWIW, I suspect that what is causing problems is the data which is retrieved to fill in the section titled "Top Searches." This is a Japanese website and one of the strings in that section is munged. I think it is in a codepage other than UTF-8 and that's what's messing things up.

  9. Gedigen
    Member
    Posted 6 years ago #

    I have he same problem with my catche.

    I just downloaded phpMyAdmin after fresten wrote about it. I hve never used i before and I just wounder what more than that "DELETE FROM wp_options WHERE option_name = 'stats_cache'" line I have to write down. It says that I need to choose a colum but I cant find any to choose from.

    please look at this pickture and see what I missed to fill in.
    http://www.gedigen.com/blogg/image/problem.jpg

    I hope you can help me,

    Tommy

  10. webartz
    Member
    Posted 6 years ago #

    Hello Frasten,

    I run manually on phpmyadmin the code (DELETE FROM wp_options WHERE option_name = 'stats_cache'), and that worked perfect.

    Thx a lot !!
    :)

  11. Gedigen
    Member
    Posted 6 years ago #

    I think I need "phpMyAdmin for dummies" . I have try to find where to put the line " DELETE FROM wp_options WHERE option_name = 'stats_cache' ".

  12. frasten
    Member
    Posted 6 years ago #

    @Gedigen:
    Hi :-)

    - Log into your phpMyAdmin page
    - select your database from the dropdown menu on your left
    - click on the SQL tab on the top of the page
    - paste the query
    - click on Execute
    - Enjoy!

Topic Closed

This topic has been closed to new replies.

About this Topic