HB Caching Exclusions adds extra backslashes

Description: In exclusion field for page caching, it adds backslashes before every dot (.). Even on save, the default exclusion "wp-.*\.php" is converted to "wp-\.*\.php"

Here is the screenshot: https://static.livechatinc.com/8801096/P433TH9F97/c451417fb2c4b4fe1f34fa85046d958a/Schermafdruk%20van%202018-02-13%2016-27-18.png

  • Ash
    • WordPress Hacker

    Hello RavanH

    I can confirm the issue on my test site, so I am marking this as a bug and reporting to the developer. Hopefully, very soon the issue will be solved and an updated will be released. We appreciate your patience on this.

    Thanks for reporting, sending some cookies on your way :slight_smile:

    Have a nice day!

    Cheers,
    Ash

  • RavanH
    • The Crimson Coder

    Hi Ash thanks for the bug report. As you requested: here is another bug (I don't think it's related though): When I go to Performance Test and hit the NEW TEST button, I get a server 500 error page. But when I go back to the Performance Test page, it appears the test is running fine. This is on an Apache shared hosting, tested PHP versions 5.6, 7.0 and 7.1

  • Anton Vanyukov
    • Developer

    Hi RavanH,

    The backslash before the dot is not a bug. Exclusion rules use regex syntax, and in regex the dot needs to be escaped with a backslash. When you save, HB will try to fix up user errors in regex syntax. And there was an error in one of the default rules (no backslash). Thus when you save, you get this wp-\.*\.php.

    Regarding the server error. Could you enable debug log and run the test? What errors are you getting in the debug log?

    Best regards,
    Anton

  • RavanH
    • The Crimson Coder

    Hi anton the regular expression wp-.*\.php means anything that starts with "wp-" and ends with ".php" with any character (the dot) between zero and infinite times (the asterisk) in between so anything like "wp-xyz123.php" would be caught.

    But the regular expression wp-\.*\.php means anything that starts with "wp-", then the escaped dot followed by the quantifier "*" means a literal dot between zero and infinite times, then ".php" so it will only catch something like "wp-....php" (where the dots mean literally dots, not 'whatever')

    This last regular expression is meaningless since there is no such file or URI to be expected. I'm pretty sure it used to be wp-.*\.php which does make sense in a WordPress environment.

  • RavanH
    • The Crimson Coder

    Sad to see this is not fixed in the latest version :slight_frown:

    Plus there is a new bug introduced: On the Browser Caching page it reports a second browser cache time for all file types even though the origina Hummingbird htaccess rules are still in place...

  • Ash
    • WordPress Hacker

    Hello RavanH

    When your bug was reported, by that the current version was already on QA team, so was not possible to add the fix in the current release. But it will be added in next release.

    About your new bug, I have just tested the new version and can't replicate. Would you please post a full page screenshot and mark that point you are talking about? That may help us to better understand.

    Have a nice day!

    Cheers,
    Ash

  • RavanH
    • The Crimson Coder

    Hi Ash, that's hopeful news :slight_smile:

    Attached a PDF print of the Hummingbird Browser Caching page. It shows the 1 second expiry time reported there. But in the htaccess there is the Hummingbird section right above the WP section :

    # BEGIN WP-HUMMINGBIRD-CACHING
    
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault A0
    
    <FilesMatch "\.(txt|xml|js)$">
    ExpiresDefault A691200
    </FilesMatch>
    
    <FilesMatch "\.(css)$">
    ExpiresDefault A691200
    </FilesMatch>
    
    <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac|eot|ttf|otf|woff|svg)$">
    ExpiresDefault A691200
    </FilesMatch>
    
    <FilesMatch "\.(jpg|jpeg|png|gif|swf|webp)$">
    ExpiresDefault A691200
    </FilesMatch>
    </IfModule>
    
    <IfModule mod_headers.c>
      <FilesMatch "\.(txt|xml|js)$">
       Header set Cache-Control "max-age=691200"
      </FilesMatch>
    
      <FilesMatch "\.(css)$">
       Header set Cache-Control "max-age=691200"
      </FilesMatch>
    
      <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac|eot|ttf|otf|woff|svg)$">
       Header set Cache-Control "max-age=691200"
      </FilesMatch>
    
      <FilesMatch "\.(jpg|jpeg|png|gif|swf|webp)$">
       Header set Cache-Control "max-age=691200"
      </FilesMatch>
    </IfModule>
    # END WP-HUMMINGBIRD-CACHING

    Also notice that in the Browser Caching settings page, the dropdown at the bottom under Configure > Expiry Time > JavaScript, CSS, Media, Images is empty and has no options to select.

    No idea why at Server Type above it, there is Cloudflare selected by default. It's an Apache server...

  • Anton Vanyukov
    • Developer

    Hi RavanH,

    This could be a result of something gone wrong during the update, because 1.8 introduced a new settings db structure to better support upcoming new and awesome features. The easiest fix is to just reset Hummingbird settings by going to this url in your admin: wp-admin/admin.php?page=wphb&wphb-clear=all
    Keep in mind, this will clear out all minification settings as well. Or you can open up support access to your website, and I will fix it for you, preserving all your current settings.

    Best regards,
    Anton

  • RavanH
    • The Crimson Coder

    Hi Anton, I did the reset and even though I got a response "Sorry, you are not allowed to access this page." (maybe because this is on a multisite?) all settings were reset. And indeed it seems all is hunky-dory again. Thanks!

  • RavanH
    • The Crimson Coder

    Funny little bug though : When I'm on the network Performance Test page on /wp-admin/network/admin.php?page=wphb-performance and I click the button CONFIGURE SCRIPT DEFERRING at the bottom of the tab "Remove render blocking resources", I get redirected to /wp-admin/admin.php?page=wphb-minification which responds with a "Sorry, you are not allowed to access this page" message again. Adding /network/ to the URL does not solve that issue.

    I found that I need to go back to the Hummingbird Dashboard and set the option ASSET OPTIMIZATION to anything but Disabled...

  • RavanH
    • The Crimson Coder

    Still there seems something weird (but unrelated?) going on :

    When I activate the CSS options Compress and Combine at the same time (for all of the stylesheets that qualify, with the Bulk Update option) it actually does nothing. No compression and no combination going on.

    Only when I set the option Combine but deactivate Compress, it will indeed combine (and compress!) most stylesheets... And vice-versa deactivating Combine and activating Compress also does what is expected.

    Is this a bug or am I doing something wrong?

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.