#105971TypolinkTagSoftReferenceParser::parse does not match if extra parameters are part of url
Description
Using the b13/link2language package, to link across languages.
The links generated now and used for resolving now contains a extra L={language} parameter. The links are as such
<a href="t3://page?uid=2879&L=1#23260">
Pattern used for matching in the TypolinkTagSoftReferenceParser::parse is
preg_match('/page\?uid=(\d+)#?(\d+)?/', $matches[1], $pageAndAnchorMatches)
This is the result of mathcing against a:
- Link to page with L parameter: <a href=“t3://page?uid=2881&L=0”> => Matches the page uid. $pageAndAnchorMatches1 being 2881
- Link to content element on page without L parameter: <a href=“t3://page?uid=2879#23263”> => Matches the page uid and content element. $pageAndAnchorMatches1 being 2879 and $pageAndAnchorMatches2 being 23263
- Link to content element on page with L parameter: <a href=“t3://page?uid=2879&L=1#23260”> => Matches the page uid. $pageAndAnchorMatches1 being 2879. No match to the content element reference. $pageAndAnchorMatches2 is empty
The expected behavior would be for the match to find a integer after uid and a integer after the hash and ignore other parameter not relevant for the parsing
External links
Somewhat related to the b13/link2language PR here: https://github.com/b13/link2language/pull/26
Reviews 3
Files 3
History 510
-
Soren Malling commented and changed attached Screenshot 2025-01-21 at 14.02.57.png <span data-processor="relativetime" data-value="2025-01-21T13:04:27+00:00" > 01/21/25, 13:04 </span>
Screenshot shows the linkvalidator accepting the link despite extra parameters and finding the deleted content element
-
Gerrit Code Review pushed patch set 1 for main to change 87838 status
NewUnder Review <span data-processor="relativetime" data-value="2025-01-21T13:33:56+00:00" > 01/21/25, 13:33 </span> -
Gerrit Code Review pushed patch set 2 for main to change 87838 <span data-processor="relativetime" data-value="2025-02-07T22:07:29+00:00" > 02/07/25, 22:07 </span>
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 88107 <span data-processor="relativetime" data-value="2025-02-08T22:53:59+00:00" > 02/08/25, 22:53 </span>
-
Soren Malling commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2025-02-08T22:55:12+00:00" > 02/08/25, 22:55 </span>Applied in changeset commit:ca666001381708af4c69ce1b0c26ec6e7013ad50.
-
Gerrit Code Review pushed patch set 1 for 12.4 to change 88329 status
ResolvedUnder Review <span data-processor="relativetime" data-value="2025-02-24T09:57:44+00:00" > 02/24/25, 09:57 </span> -
Gerrit Code Review pushed patch set 2 for 12.4 to change 88329 <span data-processor="relativetime" data-value="2025-02-24T10:15:50+00:00" > 02/24/25, 10:15 </span>
-
Soren Malling commented and changed status
Under ReviewResolved <span data-processor="relativetime" data-value="2025-03-19T07:40:09+00:00" > 03/19/25, 07:40 </span>Applied in changeset commit:7c7ea7d3a7df108f50f71300db3682ced5d36b7f.
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2025-12-02T14:26:45+00:00" > 12/02/25, 14:26 </span>
Asking ChatGPT for a helping hand to build a pattern “we” came up with this
https://regex101.com/r/MI3YOX/1
Pattern:
Testcases:
Returned values per testcase: