• Resolved adorablepaws

    (@adorablepaws)


    I use WP Super Cache on four websites. All of them show this warning, if debug is set to true:

    Warning: preg_grep(): Compilation failed: missing terminating ] for character class at offset 19 in /users/xx/folder/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 1748

    Warning: Cannot modify header information – headers already sent by (output started at /users/xx/folder/wp-content/plugins/wp-super-cache/wp-cache-phase2.php:1748) in /users/users/xx/folder /wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 1478

    This happens with php 7.4 and 8.0. The only reference I see in the warnings is the wp-cache-phase2.php. I also double checked the entries in wp-config and htaccess. Everything seems to be correct.

    I know it’s “only” a warning, but I’d appreciate your help to get rid of the warning.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Mark (a11n)

    (@thingalon)

    Hi @adorablepaws,

    Thanks for the issue report.

    Line 1748 in wp-cache-phase2.php is where Super Cache applies the “Rejected Cookies” setting from the “Advanced” tab in your Super Cache settings. Each line in that setting is treated as a Regular Expression, so if you have a stray “[” character in there it might get confused.

    Can you please check your Rejected Cookies setting, and make sure there are no square brackets or other special characters included?

    If you need help sorting out a complex Rejected Cookie setting using a Regular Expression, please let me know what settings you are aiming for and I can guide you on how to set it up.

    Thread Starter adorablepaws

    (@adorablepaws)

    Hi @thingalon ,

    these are my excluded cookies:
    woocommerce_cart_hash
    woocommerce_items_in_cart
    wp_woocommerce_session_
    woocommerce_recently_viewed
    store_notice[notice
    id]

    If I understood it correctly, the ] of the last one store notice could be causing the error? I actually don’t even remeber adding that last line. However, I’ll delete it and we’ll see whether the warning still comes up.

    Plugin Contributor Mark (a11n)

    (@thingalon)

    Hi @adorablepaws,

    I think the issue is in the last two lines:

    
    store_notice[notice
    id]
    

    It looks like it’s supposed to search for “store_notice[noticeid]” in your cookies. If you change that to “store_notice\[noticeid\]” (all on one line), it should resolve the issue.

    Be sure to include that backslashes \, as it will tell Super Cache that you want to match with an exact “[” character, and it won’t get it confused with a Regular Expression control character.

    Thread Starter adorablepaws

    (@adorablepaws)

    Yes, it’s now working fine with no more warnings. I just deleted the whole store_notice line.

    Thank you for your help @thingalon . Much appreciated!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Debug warnings in file wp-cache-phase2.php’ is closed to new replies.