Bug #104190
openrestrict "Unsafe captching group regex"-message to only used replacements
0%
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?)
Updated by Garvin Hicking 5 months ago
- Related to Bug #102176: Missing error suppression for preg_match in RedirectService added
Updated by Garvin Hicking 5 months ago
- Status changed from New to Needs Feedback
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!
Updated by Mordamir 5 months ago
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.
Updated by Garvin Hicking 5 months ago
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
Updated by Stefan Bürk 14 days ago
@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) ?
Updated by Mordamir 13 days ago
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