Inconsistent use of == and === within Paginator.php
Сообщение об ошибке / Error message
N/A
Резюме / Summary
Inconsistent use of == and === within Paginator.php means that tplPageActive is not always used when it should be.
Specifically, public_html\core\components\pdotools\src\Support\Paginator.php sometimes uses $page === (lines 212, 319, 434, 454) and other times uses $page == (lines 297, 360, 372, 415). The result is that the Paginator functions sometimes fails to use the tplPageActive in the correct places.
Шаг для воспроизведения / Step to play
I am using pdoPage as below. Tested with a pageLimit of 8 and 10 (to test output of both buildModernPagination() and buildClassicPagination().
Pagination will correctly use tplPageActive up until page 5. Page 6 does not show tplPageActive even if you are on page 6.
[[!pdoPage?
&parents=`123`
&depth=`0`
&limit=`24`
&ajaxMode=`default`
&pageLimit=`10`
&includeContent=`1`
&tpl=`liTeamItem`
&tplEmpty=`pdoPageNoResults`
&frontend_js=`[[+assetsUrl]]js/jquery.pdopage.min.js`
&frontend_startup_js=`pdoPagefrontendStartupJS`
&frontend_init_js=`pdoPagefrontendInitJS`
&ajaxElemPagination=`#pdopage .pagination`
&ajaxElemLink=`#pdopage .pagination a`
&tplPageWrapper=`@INLINE <div class="pagination d-flex justify-content-center mt-50">
<ul class="pagination">[[+first]][[+prev]][[+pages]][[+next]][[+last]]</ul>
</div>`
&tplPage=`@INLINE <li class="page-item"><a class="page-link text-decoration-none fw-light"
href="[[+href]]">[[+pageNo]]</a></li>`
&tplPageActive=`@INLINE <li class="page-item active"><a
class="page-link text-decoration-none fw-medium text-primary" href="[[+href]]">[[+pageNo]]</a>
</li>`
&tplPageFirst=`@INLINE <li class="page-item"><a class="page-link text-decoration-none fw-light"
href="[[+href]]">[[%nav.first? &topic=`default` &namespace=`bsp`]]</a></li>`
&tplPageLast=`@INLINE <li class="page-item"><a class="page-link text-decoration-none fw-light"
href="[[+href]]">[[%nav.last? &topic=`default` &namespace=`bsp`]]</a></li>`
&tplPagePrev=`@INLINE <li class="page-item"><a class="page-link text-decoration-none fw-light"
href="[[+href]]"><i class="fs-14 icon-bsp-arrow-left text-accent-4 fw-light"></i></a></li>`
&tplPageNext=`@INLINE <li class="page-item"><a class="page-link text-decoration-none fw-light"
href="[[+href]]"><i class="fs-14 icon-bsp-arrow-right text-accent-4 fw-light"></i></a></li>`
&tplPagePrevEmpty=`@INLINE `
&tplPageNextEmpty=`@INLINE `
&showLog=`0`
]]
Наблюдаемое поведение / Observed behavior
I inserted logging statements into Paginator.php after every call to $this->pdoTools->config('tplPageActive'); and $this->pdoTools->config('tplPage'); and observed cases where the code notes that 6 !== 6
Classic Pagination
[2025-12-11 17:57:11] (ERROR @ /home/site/public_html/core/components/pdotools/src/Support/Paginator.php : 324) Paginator: Classic - 6 !== 1
[2025-12-11 17:57:11] (ERROR @ /home/site/public_html/core/components/pdotools/src/Support/Paginator.php : 324) Paginator: Classic - 6 !== 2
[2025-12-11 17:57:11] (ERROR @ /home/site/public_html/core/components/pdotools/src/Support/Paginator.php : 324) Paginator: Classic - 6 !== 3
[2025-12-11 17:57:11] (ERROR @ /home/site/public_html/core/components/pdotools/src/Support/Paginator.php : 324) Paginator: Classic - 6 !== 4
[2025-12-11 17:57:11] (ERROR @ /home/site/public_html/core/components/pdotools/src/Support/Paginator.php : 324) Paginator: Classic - 6 !== 5
[2025-12-11 17:57:11] (ERROR @ /home/site/public_html/core/components/pdotools/src/Support/Paginator.php : 324) Paginator: Classic - 6 !== 6 // INCORRECT!!!!
[2025-12-11 17:57:11] (ERROR @ /home/site/public_html/core/components/pdotools/src/Support/Paginator.php : 324) Paginator: Classic - 6 !== 7
[2025-12-11 17:57:11] (ERROR @ /home/site/public_html/core/components/pdotools/src/Support/Paginator.php : 324) Paginator: Classic - 6 !== 8
[2025-12-11 17:57:11] (ERROR @ /home/site/public_html/core/components/pdotools/src/Support/Paginator.php : 324) Paginator: Classic - 6 !== 9
[2025-12-11 17:57:11] (ERROR @ /home/site/public_html/core/components/pdotools/src/Support/Paginator.php : 324) Paginator: Classic - 6 !== 10
Modern Pagination
[2025-12-11 17:57:46] (ERROR @ /home/site/public_html/core/components/pdotools/src/Support/Paginator.php : 368) Paginator: Left - 6 != 1
[2025-12-11 17:57:46] (ERROR @ /home/site/public_html/core/components/pdotools/src/Support/Paginator.php : 368) Paginator: Left - 6 != 2
[2025-12-11 17:57:46] (ERROR @ /home/site/public_html/core/components/pdotools/src/Support/Paginator.php : 382) Paginator: Right - 6 != 9
[2025-12-11 17:57:46] (ERROR @ /home/site/public_html/core/components/pdotools/src/Support/Paginator.php : 382) Paginator: Right - 6 != 10
[2025-12-11 17:57:46] (ERROR @ /home/site/public_html/core/components/pdotools/src/Support/Paginator.php : 448) Paginator: Center2 - 6 !== 5
[2025-12-11 17:57:46] (ERROR @ /home/site/public_html/core/components/pdotools/src/Support/Paginator.php : 448) Paginator: Center2 - 6 !== 6 // INCORRECT!!!!
[2025-12-11 17:57:46] (ERROR @ /home/site/public_html/core/components/pdotools/src/Support/Paginator.php : 448) Paginator: Center2 - 6 !== 7
[2025-12-11 17:57:46] (ERROR @ /home/site/public_html/core/components/pdotools/src/Support/Paginator.php : 448) Paginator: Center2 - 6 !== 8
Ожидаемое поведение / Expected behavior
Replacing all instances of strict comparison checking using $page === (on lines 212, 319, 434, 454) and instead using $page == should fix this behaviour.
Environment
MODX 3.1.2-pl, pdoTools 3.0.2-pl