• Hello,

    We see this warning in the PHP error log of a site running Breeze 2.6.1 (it was the same on 2.6.0):

    PHP Warning:  Array to string conversion in .../wp-content/plugins/breeze/inc/cache/execute-cache.php on line 1039

    Cause: Breeze_Execute_Cache::get_wp_logged_in_cookie_value() loops over every cookie and casts the value to a string before checking the cookie name:

    foreach ( $_COOKIE as $cookie_name => $cookie_value ) {
        $cookie_name  = (string) $cookie_name;
        $cookie_value = (string) $cookie_value;   // line 1039
        // the wordpress_logged_in_ name check comes only after this

    Breeze itself sets the cookie breeze_commented_posts[<post_id>] for visitors who left a comment (inc/cache/purge-cache.php, line 174), and reads it back as an array in execute-cache.php (line 977). PHP parses a cookie name with square brackets into an array, so $_COOKIE['breeze_commented_posts'] is an array, and the cast on line 1039 raises the warning when such a visitor opens a page.

    Steps to reproduce:

    1. Enable page cache in Breeze.
    2. Leave a comment as a guest on any post, so the browser gets breeze_commented_posts[123].
    3. Open any page: the warning appears in the PHP error log.

    Suggested fix: skip non-string values before the cast, or check the name first, for example:

    foreach ( $_COOKIE as $cookie_name => $cookie_value ) {
        if ( ! is_string( $cookie_value ) ) {
            continue;
        }
        $cookie_name = (string) $cookie_name;

    The value of such a cookie can never be a wordpress_logged_in_ cookie anyway, so skipping it does not change the behaviour of the check.

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author owaisalam

    (@owaisalam)

    Thanks for the report.

    When a guest leaves a comment, Breeze sets a cookie named breeze_commented_posts[123], which PHP reads as an array. On the next page view, the function get_wp_logged_in_cookie_value() converts every cookie value to a string before checking the cookie name. That causes the “Array to string conversion” notice on line 1039 of execute-cache.php.

    This doesn’t affect caching, and it isn’t visible on the front end when WP_DEBUG_DISPLAY is off. It only shows up in the PHP error log.

    We’re looking into how to handle non-text cookie values in that check. Thanks for helping us track this down.

    Thread Starter webnovelty

    (@webnovelty)

    Thanks for confirming. We will test the next release on our staging site (guest comment, then a page view) and report back here.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.