typo3-realurl
typo3-realurl copied to clipboard
[BUGFIX] Consistently integrate addWhereClause
The addWhereClause is twice prefixed by a space and twice not. This change makes all occurences consistently include a prefix space, thus avoiding possibly invalid sql.
Other occurences, already prefixed with a space: https://github.com/dmitryd/typo3-realurl/blob/58a17ac0b561729412b2afd53b6a106c3755192e/Classes/Decoder/UrlDecoder.php#L318-L321 https://github.com/dmitryd/typo3-realurl/blob/58a17ac0b561729412b2afd53b6a106c3755192e/Classes/Encoder/UrlEncoder.php#L420-L422
On the other hand, the wiki already states:
addWhereClause
is an additional WHERE clause that must start with' AND'
.
(https://github.com/dmitryd/typo3-realurl/wiki/Configuration-reference#lookuptable) so another option would be to consistently not include the space before the additional where-clause.
The current code poses a little trap, because it is not immediately obvious that you have a wrong configuration, since it works in some cases.
I'm happy to change the pull request into removing the additional space on every occurence if you like that better. I just recommend to avoid the inconsistency.
Read the docs:
addWhereClause
is an additional WHERE clause that must start with ' AND'. For example: ' AND deleted=0 AND hidden=0'.
Basically the space should be in addWhereClause
. The space in the code is probably left after rearranging or removing other conditions. It should be removed.
Changed the pull request to consistently not include a space.
I like the change but I am afraid that there will be people who do not use space and will complain that their setup suddenly stopped working.