Commit 594d8a9c authored by Merlin Axel Rutz's avatar Merlin Axel Rutz Committed by Anish Anilkumar
Browse files

Issue #2606536 by axel.rutz: WSOD due to memory issues

parent bea277c5
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -266,6 +266,12 @@ function disable_messages_settings_form() {
    '#default_value' => variable_get('disable_messages_ignore_case', '1'),
    '#description' => t('Check this to ignore case while matching the patterns.'),
  );
  $form['disable_messages_anchor_regex'] = array(
    '#type' => 'checkbox',
    '#title' => t('Anchor regex'),
    '#default_value' => variable_get('disable_messages_anchor_regex', '1'),
    '#description' => t('Check this to anchor regex to begin and end of message. Note that the necessary wildcards may cause memory issues.'),
  );
  $form['disable_messages_filter_options'] = array(
    '#type' => 'fieldset',
    '#title' => t('Page and user level filtering options'),
@@ -372,7 +378,10 @@ function disable_messages_settings_form_submit($form, &$form_state) {
  $ignore_case = (variable_get('disable_messages_ignore_case', '0') == '1') ? 'i' : '';
  foreach ($patterns as $pattern) {
    $pattern = preg_replace(array('/^\s*/', '/\s*$/'), '', $pattern);
    $pattern = '/^' . $pattern . '$/su' . $ignore_case;
    if (variable_get('disable_messages_anchor_regex', 1)) {
      $pattern = '^' . $pattern . '$';
    }
    $pattern = '/' . $pattern . '/su' . $ignore_case;
    $regexps[] = $pattern;
  }
  variable_set('disable_messages_ignore_regex', $regexps);