#104190restrict "Unsafe captching group regex"-message to only used replacements
Description
Currently the replaceRegExpCaptureGroup function inside the RedirectService is generating a warning message for every capture group which contains a question mark.
The problem is, that this message is generated for every captured group, even if it is not used. Especially for capturing group zero, which always contains the whole matched string.
Alternatives:
- throw away match zero (unset $matches0) (is it allowed to use $0 in the target url?)
- check if replacement string is used (does the target url contain a $0 placeholder?)
Reviews 3
Related issues 1
History 711
-
Garvin Hicking changed Related to #102176 06/24/24, 08:39
-
Garvin Hicking commented and changed status
NewNeeds Feedback 06/24/24, 08:40 -
Mordamir commented 06/24/24, 08:55
No, this is a different problem. Its not about suppressing errors from wrong preg-expressions.
It is about the match zero value from the preg_match-function, which always contains the question mark if the redirect has the “Respect GET Parameters”-flag set. If the target url does not contain a $0-placeholder, the redirectService should not write the “Unsafe captching group regex…”-warning in the log file.
-
Garvin Hicking commented 06/24/24, 09:10
Actually the other patch would suppress all preg_match errors, not only from “wrong” ones.
But thank you for the reply, will try to reproduce and analyze -
Stefan Bürk commented 11/07/24, 16:07
@mordamir Can you provide some example ?
The used regexp string and the url/request matching that request but triggering the error ? (one or two examples) ?
-
Mordamir commented 11/08/24, 14:35
As Source Path
#^/partner\?tx_extension_clients.+client(?:%5D|\])=([A-Z0-9]+)#
And as Target
/partner/$1
Its mainly to redirect some old urls (example.com/partner?tx_extension_clients[controller]=Clients&tx_extension_clients[client]=ACME1) to the new shorter form of (example.com/partner/ACME1
-
Gerrit Code Review pushed patch set 1 for main to change 97496 status
Needs FeedbackUnder Review 11/10/26, 06:23 -
Gerrit Code Review pushed patch set 2 for main to change 97496 11/10/26, 07:44
-
Gerrit Code Review pushed patch set 1 for 14.3 to change 97574 11/12/26, 10:32
-
Gerrit Code Review pushed patch set 2 for 14.3 to change 97574 11/12/26, 13:35
-
Benni Mack commented and changed status
Under ReviewResolved done0 %100 % 11/12/26, 13:45Applied in changeset commit:7e6fd0f9532bcf24281debb8c15eb0de9e7f6603.
I think https://review.typo3.org/c/Packages/TYPO3.CMS/+/84872 is related to this and probably will soon be merged; does this solve your issue?
Thanks for your report!