-
Notifications
You must be signed in to change notification settings - Fork 87
Open
Labels
Description
Pagination from pdoPage is not working on PHP 8
Summary
when using pdoPage the pagination is not working as expected, due to a change in the PHP function preg_quote
Шаг для воспроизведения / Step to play
Example:
[[!pdoPage?
&tplWrapper=`WTpl`
&wrapIfEmpty=`1`
&tpl=`Tpl`
&pageLinkScheme=`[[+pageVarKey]]-[[+page]]`
&pageVarKey=`page`
]]
- in Frontend the pagination link are like this: https://domainl.com/page-3
- click on a pagination link, e.g. page 2 --> page loads
- see the generated links and click on e.g. page 4. you get: https://domain.com/page-3page-4
the link is not generated properly
Наблюдаемое поведение / Observed behavior
described above.
Ожидаемое поведение / Expected behavior
The generated links should always be https://domain.com/page-X
Environment
All Version.
Solution
in pdoTools function makePageLink there is the PHP function preg_quote used in a regex.
preg_replace('#' . preg_quote($pcre, '#') . '#', '', $url)
this PHP function does escape "#" as of PHP Version 8 and thus breaks the preg_replace.
remove it and get:
preg_replace('#' . $pcre . '#', '', $url)