-
Notifications
You must be signed in to change notification settings - Fork 126
Description
Problem:
We have tt_news entries with the error no news_id given
in SINGLE view. Debugging shows that TYPO3 requests tx_ttnews[tt_news]=the-news-title-as-path-segment
instead of tx_ttnews[tt_news]=123
. That happens when UrlDecoder->convertAliasToId()
tries a reverse lookup from the table tt_news.title
and fails. Because of that UrlDecoder->decodeUrlParameterBlockUseAsIs()
is executed and creates the aforementioned dysfunctional GETvar
with the path segement instead of an id.
Further down the line a cache entry is created where the-news-title-as-path-segment points to a url containing tx_ttnews[tt_news]=the-news-title-as-path-segment
(created when the SINGLE view is loaded), but other cache entries with the-news-title-as-path-segment can exist pointing to a url with tx_ttnews[tt_news]=123
(created when the LIST view is loaded). In that case RealURL will choose the first entry it finds and considers valid, but that can be the one with the dysfunctional GETvar
.
Solution:
Back to UrlDecoder->convertAliasToId()
: We can in fact use a better lookup from the table. $value
is split by -
and a WHERE clause is created of the form
alias_field LIKE '%the%%news%%title%%as%%path%%segment%'
.
That takes care of all the commas, hyphens, and other characters that might be in alias_field
. Our problem has been solved by that.
While we are much more likely to find a database row this way we might run into false positives when the regular expression fits more than one entry. In that case we can assume that the shortest hit is the right one.
I have created a pull request to take care of the issue. #614