pdoTools
pdoTools copied to clipboard
pdoPage: Undefined variable $showLog
Hi, I get this message in the error log:
ERROR @ .../modx/core/cache/includes/elements/modx/revolution/modsnippet/10.include.cache.php : 209) PHP warning: Undefined variable $showLog
My quick & dirty fix in Snippets -> pdoTools -> pdoPage
(set the var $showLog):
/** @var bool $showLog */
$showLog ='';
if ($modx->user->isAuthenticated('mgr') && (bool)$showLog) {
$modx->setPlaceholder('pdoPageLog', print_r($paginator->pdoTools->getTime(), true));
}
Maybe you can fix that in the next update?
- MODX 3.0.1-pl installation on Linux Server
- PHP: 8.1.11
- mySQL: 8.0.30
- pdoTools 3.0.1-pl
Tks Jo
I cannot create a pull request because I can't find pdoTools 3.0.x-pl on GitHub. But I think this solution with the isset function is the better way:
/** @var bool $showLog */
if (isset($showLog) && $modx->user->isAuthenticated('mgr') && (bool)$showLog) {
$modx->setPlaceholder('pdoPageLog', print_r($paginator->pdoTools->getTime(), true));
}
It's here as well: [2024-04-04 09:23:01] (ERROR @ /www/core/cache/includes/elements/modx/revolution/modsnippet/7.include.cache.php : 210) PHP warning: Undefined variable $showLog (ModX 3.04 - Modx cloud)
Apparently this wasn't fixed in pdoTools 3.0.2 or MODx 3.0.5 or wherever it needs to be fixed.
Running with PHP 8.2.
If one of the fixes above works, where should it be changed? Changing it the cached file that is reported in the error logs doesn't work if the MODx cache is cleared.
I have also tried updating it in the file: core/components/pdotools/elements/snippets/snippet.pdopage.php
, but that doesn't fix the cached file either.