Skip to content
Snippets Groups Projects

skip known procedural hooks for BC layer

1 unresolved thread

Closes #3493043

Merge request reports

Members who can merge are allowed to add commits.
Code Quality is loading
Test summary results are being parsed
Metrics reports are loading
Ready to merge by members who can write to the target branch.
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
368 368 static fn ($x) => preg_quote($x, '/'),
369 369 $modules_by_length,
370 370 ));
371 $module_preg = '/^(?<function>(?<module>' . $known_modules_pattern . ')_(?!update_\d)(?<hook>[a-zA-Z0-9_\x80-\xff]+$))/';
371 $module_preg = '/^(?<function>(?<module>' . $known_modules_pattern . ')_(?!.+update_\d)(?<hook>[a-zA-Z0-9_\x80-\xff]+$))/';
  • Storing here for future reference:

    $modules = ['redirect_404', 'redirect'];
        $modules_by_length = $modules;
        usort($modules_by_length, static fn ($a, $b) => strlen($b) - strlen($a));
        $known_modules_pattern = implode('|', array_map(
          static fn ($x) => preg_quote($x, '/'),
          $modules_by_length,
        ));
        $module_preg = '/^(?<function>(?<module>' . $known_modules_pattern . ')_(?<hook>[a-zA-Z0-9_\x80-\xff]+$))(?<!update_\d)(?<!update_\d\d)(?<!update_\d\d\d)(?<!update_\d\d\d\d)/';
    print $module_preg;
    preg_match($module_preg, 'redirect_404_update_8101', $matches);
    preg_match($module_preg, 'redirect_404_cron', $matches);
    var_dump($matches);

    Had a discussion with @GhostOfDrupalPast about this and he thinks this is the correct way to fix the concern here: https://3v4l.org/Nh9IQ

  • Here is the final version:

    $module_preg = '/^(?<function>(?<module>' . $known_modules_pattern . ')_(?!.+update_\d+$)(?<hook>[a-zA-Z0-9_\x80-\xff]+$))/';
  • Suggested change
    371 $module_preg = '/^(?<function>(?<module>' . $known_modules_pattern . ')_(?!.+update_\d)(?<hook>[a-zA-Z0-9_\x80-\xff]+$))/';
    371 $module_preg = '/^(?<function>(?<module>' . $known_modules_pattern . ')_(?!.+update_\d+$)(?<hook>[a-zA-Z0-9_\x80-\xff]+$))/';
  • Please register or sign in to reply
Please register or sign in to reply
Loading