I just had to bugfix a user who entered "feeds/events\" as page path. The backslash breaks a preg_grep() at line 364 in views.module. This was pretty hard to find.

While the cause is a misformed user input, it might be a good idea to escape the strings there.
I do not think it has security implications though.

Comments

ygerasimov’s picture

Status: Active » Needs review
StatusFileSize
new715 bytes

Here is patch to replace backslash with double backslashes.

jkurrle’s picture

I was getting a similar message with version 7.x-3.7 on line 418 of the views module. (Warning: preg_grep(): Unknown modifier 'o' in views_menu_alter() line 418) Turns out line 417 was using a hashmark (#) as a preg_replace delimiter. I replaced the hashmarks with cent signs (¢ - ascii 155) and the issue went away.

Line 417 before:

$regex = '#^(' . preg_replace('#%views_arg#', '%[^/]*', implode('|', array_keys($result))) . ')$#';

Line 417 after:

$regex = '¢^(' . preg_replace('¢%views_arg¢', '%[^/]*', implode('|', array_keys($result))) . ')$¢';

Maybe this will help someone else...

labboy0276’s picture

Issue summary: View changes

I added a more universal solution to the issue in #2: https://www.drupal.org/node/2694365

chris matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

The 6 year old patch to views.module does not apply to the latest views 7.x-3.x-dev and if still relevant needs to be rerolled.

Checking patch views.module...
error: while searching for:
      // in the display path, then we use this constructed regex
      // (which will be something like '#^(foo/%[^/]*/bar)$#') to
      // search through the existing paths.
      $regex = '#^(' . preg_replace('#%views_arg#', '%[^/]*', implode('|', array_keys($result))) . ')$#';
      $matches = preg_grep($regex, array_keys($callbacks));

      // Remove any conflicting items that were found.

error: patch failed: views.module:412
error: views.module: patch does not apply
andrew answer’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new772 bytes

Patch rerolled.