Jump to content

[Solved] Console Error in Tracy debug bar when bootstrapping PW


iank
 Share

Recommended Posts

Hey @adrian,

I came across a minor problem which prevents the Tracy console showing in the debug bar when bootstrapping PW in a standalone PHP script.   The error shown is:

ErrorException: foreach() argument must be of type array|object, null given in D:\laragon\www\[sitename]\site\assets\cache\FileCompiler\site\modules\TracyDebugger\panels\ConsolePanel.php:172
Stack trace:
#0 D:\laragon\www\[sitename]\site\assets\cache\FileCompiler\site\modules\TracyDebugger\panels\ConsolePanel.php(172): Tracy\Bar->Tracy\{closure}(2, 'foreach() argum...', 'D:\\laragon\\www\\...', 172)
#1 D:\laragon\www\[sitename]\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy-2.10.x\src\Tracy\Bar\Bar.php(143): ConsolePanel->getPanel()
#2 D:\laragon\www\[sitename]\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy-2.10.x\src\Tracy\Bar\Bar.php(115): Tracy\Bar->renderPanels('')
#3 D:\laragon\www\[sitename]\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy-2.10.x\src\Tracy\Bar\Bar.php(89): Tracy\Bar->renderPartial('main')
#4 D:\laragon\www\[sitename]\site\modules\TracyDebugger\tracy-2.10.x\src\Tracy\Debugger\DevelopmentStrategy.php(123): Tracy\Bar->render(Object(Tracy\DeferredContent))
#5 D:\laragon\www\[sitename]\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy-2.10.x\src\Tracy\Debugger\Debugger.php(314): Tracy\DevelopmentStrategy->renderBar()
#6 [internal function]: Tracy\Debugger::shutdownHandler()
#7 {main}

And this is what the debug bar looks like: 

image.png.c1ae780a963fe3d088f0c2d7d411cdf8.png

I think it should be a simple fix - it looks like the line 172 is traversing $p->fields, but $p is a NullPage at this point.

Kind regards,
Ian.

Link to comment
Share on other sites

Hi @iank - sorry, I can't reproduce here at the moment. When I bootstrap, that $p is PW's 404 page, but even if I force it to null before then there is still no error because of the if($p) check on line 171.

Not really sure why it's NullPage in your case, but I have added a check which should fix things regardless.

Link to comment
Share on other sites

Hi @adrian,

Thanks - I shouldn't have been so hasty - it was just in one PW install, where I'd (several years ago) set the $config->externalPageID to 0 to try to work around this situation when logging 404s: https://github.com/processwire/processwire-issues/issues/259

In other installs everything is fine; and I don't even think that config setting is actually solving anything for me anyway; 

But thanks as always for such a quick response!

Regards,
Ian.

Link to comment
Share on other sites

  • iank changed the title to [Solved] Console Error in Tracy debug bar when bootstrapping PW

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...