• On line 19 of quick-adsense/includes/widgets.php you call get_the_content(). If the global $pages variable is not an array, PHP will generate the following error message in the error log:

    PHP Warning: count(): Parameter must be an array or an object that implements Countable in /home/soapdirt/public_html/wp-includes/post-template.php on line 284

    The log was 2GB in size when a client asked me to look at some problems in their site. The “quick fix” (see what I did there?) is to simply add the following before line 19 of quick-adsense/includes/widgets.php:

    global $pages;
    if ( !isset( $pages ) || !is_array( $pages ) ) {
        $pages = array();
    }

    I am hoping you will do this before your next release so that the client upgrading won’t cause the problem to recur.

    • This topic was modified 5 years, 3 months ago by Mike Schinkel. Reason: formatting
    • This topic was modified 5 years, 3 months ago by Mike Schinkel.
    • This topic was modified 5 years, 3 months ago by Mike Schinkel.
    • This topic was modified 5 years, 3 months ago by Mike Schinkel. Reason: formatting
    • This topic was modified 5 years, 3 months ago by Mike Schinkel. Reason: fix wrong line #

    The page I need help with: [log in to see the link]

  • The topic ‘Bug in 2.4 generates multiple PHP error log entries per page load’ is closed to new replies.