Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdoPage: Undefined variable $showLog #351

Open
jolichter opened this issue Nov 1, 2022 · 4 comments
Open

pdoPage: Undefined variable $showLog #351

jolichter opened this issue Nov 1, 2022 · 4 comments

Comments

@jolichter
Copy link

jolichter commented Nov 1, 2022

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

@jolichter
Copy link
Author

jolichter commented Dec 27, 2022

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));
}

@Esger
Copy link

Esger commented Apr 4, 2024

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)

@pixelstuff
Copy link

pixelstuff commented Apr 21, 2024

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.

pixelstuff added a commit to pixelstuff/pdoTools that referenced this issue Apr 21, 2024
Attempting to resolve error discussed here:
modx-pro#351
@lottaar
Copy link

lottaar commented Feb 14, 2025

Perhaps not a fix as such, but setting &showLog=0 gets rid or the error at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants