Problem/Motivation

When redirect patterns are URL paths that contain slashes, hits to pages generate preg_match warnings. If there are a large number of redirects defined, this can cause the logs to fill up pretty quickly, especially when hackers keep trying to access xmlrpc.php or any number of other pages that don't exist.

Steps to reproduce

  1. Go to /admin/config/broken_link_redirect and create a redirect - use a file path that contains a / in the pattern
  2. Try to access a page that does not exist (our example was xmlrpc.php)
  3. Review the DB logs - there will be a warning about an unknown modifier from the preg_match function

Proposed resolution

Escape slashes in the pattern before calling preg_match. I have included a patch for this.

Comments

cobblestone.consulting’s picture

Issue summary: View changes