- 🇭🇺Hungary Gábor Hojtsy Hungary
Closed 🐛 Twig Deprecation Analyzer directs to drupal.org 404 page because of dots Closed: duplicate as duplicate, transfering credit here.
- 🇭🇺Hungary Gábor Hojtsy Hungary
Also closed 🐛 Twig "if" condition on "for" deprecated message has bad link Closed: duplicate as duplicate and transfering credit here.
- Status changed to Needs review
almost 2 years ago 3:59pm 10 March 2023 - 🇭🇺Hungary Gábor Hojtsy Hungary
Thanks @anoopjohn for working on this. You propose this change:
- $formatted_error = preg_replace('!See (https://drupal.org(.\S+))(\.|$)!', 'See <a href="\1">\1<a>.', $formatted_error); + $formatted_error = preg_replace('!See (https://drupal.org\S*?)(\.)*(\s|$)!', 'See <a href="\1">\1<a>\2\3', $formatted_error);
The first change makes the \S matching non-greedy, then you introduce zero or more dots then either whitespace or end of string. I think this matches well with the intent that we need to match to a dot or an end of string and then introduces the option to also potentially end in a space. What's the use case for matching multiple dots? That looks odd to me. I would write it as
(https://drupal.org\S*?)(\.|\s|$)
to be clearer, then a non-greedy match is followed by a dot or whitespace or end of string. I don't think we need to care for what is after the dot or whitespace or the end of string :DWhile we are there, we can also further tweak it to resolve the optional
www.
question, I believe this then satisfies all your test cases:preg_replace('!See (https://(www.)?drupal.org\S*?)(\.|\s|$)!', 'See <a href="\1">\1</a>\3', $string);
Shared an online PHP run of these at https://onlinephp.io/c/ceba2 and I see it works as expected?
I committed this proposal to the MR, can you double check? Thanks!
- Status changed to RTBC
almost 2 years ago 12:47pm 14 March 2023 - 🇭🇺Hungary Gábor Hojtsy Hungary
Closed 🐛 Link in 'missing core_version_requirement' report not working Closed: duplicate as duplicate just now. Looks like I should not wait more with committing this :D Transferring credits from there.
- 0f3c43cd committed on 4.x
Issue #3319354 by anoopjohn, Gábor Hojtsy, undersound3, bserem, mandclu...
- 0f3c43cd committed on 4.x
- Status changed to Fixed
almost 2 years ago 5:30pm 14 March 2023 - 🇭🇺Hungary Gábor Hojtsy Hungary
Landed this, will release in 4.0 and 3.x shortly.
- 877d413f committed on 8.x-3.x
Issue #3319354 by anoopjohn, Gábor Hojtsy, undersound3, bserem, mandclu...
- 877d413f committed on 8.x-3.x
Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
over 1 year ago 6:00pm 28 March 2023 - 🇺🇸United States anoopjohn Washington D. C.
Sorry, missed this earlier. Happy to see this fixed. Thanks for pushing the fix @Gábor Hojtsy