Bug #87744

Unknown modifier 'r'

Added by R3 H6 29 days ago. Updated 15 days ago.

Status:
Resolved
Priority:
Must have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2019-02-19
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Redirect throws error in frontend (any page).

(1/1) #1476107295 TYPO3\CMS\Core\Error\Exception

PHP Warning: preg_match(): Unknown modifier 'r' in /var/www/web/typo3/sysext/redirects/Classes/Service/RedirectService.php line 82

at TYPO3\CMS\Core\Error\ErrorHandler->handleError(2, 'preg_match(): Unknown modifier \'r\'', '/var/www/web/typo3/sysext/redirects/Classes/Service/RedirectService.php', 82, array('r', 'S'))

Associated revisions

Revision 1254b62c (diff)
Added by Markus Klein 15 days ago

[BUGFIX] Catch possible error due to wrong redirect regex

Capture possible errors due to invalid regex for redirects.
Log those errors as warnings.
Additionally the placeholder text of the source field is enhanced
with a proper example for a regex.

Resolves: #87744
Releases: master, 9.5
Change-Id: Ia4fa763282d91f9e69e2050df3a26c50633ee08b
Reviewed-on: https://review.typo3.org/c/59817
Reviewed-by: Susanne Moog <>
Reviewed-by: Frank Naegler <>
Reviewed-by: Benni Mack <>
Tested-by: TYPO3com <>
Tested-by: Frank Naegler <>
Tested-by: Benni Mack <>

Revision 4e6e8f0c (diff)
Added by Markus Klein 15 days ago

[BUGFIX] Catch possible error due to wrong redirect regex

Capture possible errors due to invalid regex for redirects.
Log those errors as warnings.
Additionally the placeholder text of the source field is enhanced
with a proper example for a regex.

Resolves: #87744
Releases: master, 9.5
Change-Id: Ia4fa763282d91f9e69e2050df3a26c50633ee08b
Reviewed-on: https://review.typo3.org/c/59847
Tested-by: TYPO3com <>
Tested-by: Benni Mack <>
Reviewed-by: Benni Mack <>

History

#1 Updated by Markus Klein 28 days ago

  • Status changed from New to Needs Feedback

What does your redirect regex look like?
I assume that it contains a slash (followed by an "r"), which causes this issue.

#2 Updated by R3 H6 21 days ago

Source Path: /fr/service/

The main issue is, that it is possible to break the whole frontend by adding a wrong regular expression.
This should not be possible. Not every editor knows about regular expressions...

The regular expression should be tested first.
Perhaps something like https://github.com/r3h6/TYPO3.EXT.error404page/blob/master/Classes/Utility/RegexUtility.php

#3 Updated by Markus Klein 21 days ago

  • Status changed from Needs Feedback to Accepted
  • Priority changed from Should have to Must have

Yes we talked about that already. I tend to forbid entering a full regex here. So the slash delimiter is fixed then and anything entered in this field is escaped before being used in the regex. (preg_quote)
Problem is that this could be a breaking change for existing installations.

#4 Updated by Gerrit Code Review 19 days ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59817

#5 Updated by Gerrit Code Review 19 days ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59817

#6 Updated by Gerrit Code Review 19 days ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59817

#7 Updated by Gerrit Code Review 19 days ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59817

#8 Updated by Gerrit Code Review 19 days ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59817

#9 Updated by Gerrit Code Review 15 days ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59817

#10 Updated by Gerrit Code Review 15 days ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59847

#11 Updated by Markus Klein 15 days ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF