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`
]]
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)
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:
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
makePageLinkthere is the PHP functionpreg_quoteused 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)