カテゴリー
WordPress

WordPress.com StatsでFatalエラーが出る

WordPress.com Stats というプラグインを先日来使っているのですが、今日

Fatal error: Only variables can be passed by reference in
     ほげほげ/wp-content/plugins/stats/stats.php stats.php on line 548

というエラーがダッシュボードのstats枠に出ているのに気が付きました。Versionは1.2.1です。当初、こんなエラーは出てなかったはずなのでおかしいなと思って調べてみると、同じトラブルに遭遇している人がやはりいました。

wp-stats plugin v. 1.2 Fatal error stats.php on line 548 (8 posts)

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
:
:
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();

この通りに変更したら解決しました。