Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The regex replacement strips %blah and replaces it with *. While, the search pattern knows that menu replacement arguments end with a /, the replacement pattern does not. The change is simple, use '[^\/]*' as the replacement string instead of '*'.
I noticed this problem because I added a modal to 'user/%user' and the regex started turning anything user/ into a modal, for example user/logout.
Comment | File | Size | Author |
---|---|---|---|
#12 | ctools_automodal-regex_too_permissive-1439762-12.patch | 3.33 KB | acrollet |
#10 | ctools_automodal-regex_too_permissive-1439762-10.patch | 3.14 KB | acrollet |
#8 | 1439762-8_regex_too_permissive.patch | 2.65 KB | jlyon |
#6 | 1439762-6_regex_too_permissive.patch | 2.42 KB | wojtha |
#1 | 1439762_1.patch | 2.1 KB | chx |
Comments
Comment #1
chx CreditAttribution: chx commentedAye but that patch is waaaaaay too little. My patch is PHP 5.3 anyone is welcome to convert down to 5.2.
Comment #2
Dave ReidI need comments. Because I'm a dumb maintainer.
Comment #3
catchI'm seeing these when installing an install profile, likely just needs an empty() check for when no paths are modal.
Comment #4
Dave Reid@catch Unrelated error or error that happens with either of the patches applied?
Comment #5
catchJust the latest patch.
Comment #6
wojtha CreditAttribution: wojtha commentedTrying to fix the bugs reported by catch in #3
Comment #7
jlyon CreditAttribution: jlyon commentedThis will throw a fatal error on php < 5.3 because of the line:
$convert_to_regexp = function ($value) { return preg_replace('/%[^\/]*/', '[^/]+', $value); };
.Any possible work-arounds? See https://github.com/wojtha/ctools_automodal/issues/1.
Edit: @chx: Obviously you knew that it was php 5.3 because you mentioned it in your post. Sorry for not catching it. I think it is important to make it work in php 5.2 for the issues outlined in the github issue. I'll see if I can figure it out.
Comment #8
jlyon CreditAttribution: jlyon commentedThis update to #6 makes the patch work with php < 5.3.
Comment #9
chx CreditAttribution: chx commentedJust FYI, the last bugfix release of 5.2 was two years ago. The last security update was 1.5 years ago. I know, I know. But, still.
Comment #10
acrollet CreditAttribution: acrollet commentedre-roll of #8 attached. This makes 2 changes:
1) The not-modal regexp was too greedy when there were no paths in it (@^@)
2) Adds comments per #2
Comment #12
acrollet CreditAttribution: acrollet commentedupdated patch attached, applies properly against head and eliminates a notice.