[Plugin: WordPress.com Stats] Loops forever on post_id -1 (3 posts)

  1. Ken
    Posted 5 years ago #

    I just found an interaction problem between the WP Stats plugin (tested with WP Stats v1.6) and one I'm writing, Picasa Album Uploader. I generate a fake post entry using post_id -1 and it's causing the Stats plugin some grief. With the stats plugin enabled, I get a max execution time exceeded at line 991 of stats.php.

    It looks like the problem is that the function dec2sixtwo() loops forever if the post_id is -1. Poking around google, the generally accepted method to generate a fake post is to use -1 for the post id.

    For right now I'm going to set $wp_query->is_page and $wp_query->is_single to false and that appears to allow things to work with both my plugin and WP stats enabled.

    Should I worry about this further? My plugin is functioning OK with these two $wp_query values as false. But this feels a bit hacky...

  2. amattie
    Posted 5 years ago #

    It's interesting that you brought this up now as I'm having the exact same problem with my plugin as well (dsIDXpress). The fake post ID I'm using is -1, but I'm unwilling to set $wp_query->is_page / $wp_query->is_single to false to make my plugin compatible with the WordPress.com Stats plugin. I'm considering setting my fake post ID to 0 instead of -1 as both plugins seem to run fine if I do that, but then I'm concerned about the compatibility of post ID 0 interfering with other plugins going forward.

    I don't know what dec2sixtwo does without really digging into it -- which I don't exactly have time for right now -- so I'm not going to submit a patch. I do hope the plugin author fixes this bug though.

  3. Ken
    Posted 5 years ago #

    I must admit that I don't like changing those settings either but it did allow things to work since the stats processing is skipped if is_page and is_single are false. I share the concern over using post ID 0 for the reasons you mention.

    dec2sixtwo() is changing a decimal value to base 62. I suppose this saves a few bytes per page that is processed. The function should handle negative values to correct the behavior.

Topic Closed

This topic has been closed to new replies.

About this Topic