Jump to content

Recommended Posts

Posted

Hello.

I used to work with TracyDebugger in my development site
(Windows 10 home + Wampserver + PHP 8.0.30).

When I tried to update the module, I got error "Call to undefined method Tracy\Helpers::getNonce()"

Quote

File: ...\site\modules\TracyDebugger\TracyDebugger.module.php:2392

2382:         * @param string $str String to minify
2383:         *
2384:         */
2385:        public static function minify($str) {
2386:            return preg_replace(array('#^\s*//.+$#m', '/\/\*.*?\*\//s', '/ {2,}/','/<!--.*?-->|\t|(?:\r?\n[ \t]*)+/s'),array('', '', ' ', ''), $str);
2387:        }
2388:    
2389:        public static function getNonceAttr(): string {
2390:            static $nonceAttr;
2391:            if($nonceAttr === null) {
2392:                $nonce = \Tracy\Helpers::getNonce();
2393:                $nonceAttr = $nonce ? ' nonce="' . \Tracy\Helpers::escapeHtml($nonce) . '"' : '';
2394:            }
2395:            return $nonceAttr;
2396:        }

I also get in Tracy's report:

Quote

Error: Call to undefined method Tracy\Helpers::getNonce() in C:\wamp64\www\cadpp.org\site\modules\TracyDebugger\TracyDebugger.module.php:2392
Stack trace:
#0 C:\wamp64\www\cadpp.org\site\modules\TracyDebugger\panels\TracyExceptionsPanel.php(62): ProcessWire\TracyDebugger::getNonceAttr()
#1 C:\wamp64\www\cadpp.org\site\modules\TracyDebugger\tracy-2.10.x\src\Tracy\Bar\Bar.php(143): ProcessWire\TracyExceptionsPanel->getPanel()
#2 C:\wamp64\www\cadpp.org\site\modules\TracyDebugger\tracy-2.10.x\src\Tracy\Bar\Bar.php(115): Tracy\Bar->renderPanels('')
#3 C:\wamp64\www\cadpp.org\site\modules\TracyDebugger\tracy-2.10.x\src\Tracy\Bar\Bar.php(89): Tracy\Bar->renderPartial('main')
#4 C:\wamp64\www\cadpp.org\site\modules\TracyDebugger\tracy-2.10.x\src\Tracy\Debugger\DevelopmentStrategy.php(123): Tracy\Bar->render(Object(Tracy\DeferredContent))
#5 C:\wamp64\www\cadpp.org\site\modules\TracyDebugger\tracy-2.10.x\src\Tracy\Debugger\Debugger.php(314): Tracy\DevelopmentStrategy->renderBar()
#6 [internal function]: Tracy\Debugger::shutdownHandler()
#7 {main}

From there on, I couldn't access anymore any site page. The only solution to keep working was to delete Tracy's folder in module folder. This means I can't even clear database data from this module.

Can you figure out what is going on?

Thanks in advance, but please take into consideration that I'm not a programmer.

Posted

Sorry @RuiVP - looks like there was an issue with getNonce() helper in the version of the Tracy core you were using. Please update to the latest version which should fix things for you.

Posted

Thank you for your swift answer, @adrian .

Just to be sure and to avoid the nth trouble with installing/uninstalling: I downloaded the new version last week. Is there a new version since then?
(sorry, I don't know in what file inside the module zip I can find the version number)

and: where can we find old versions of the modules? (for example, in case the new one rise some incompatibilities with other modules, PHP version, etc.)

Once again, thank you for your trouble answering me.

Posted
27 minutes ago, adrian said:

Yep, I just released a new version to fix the issue you just reported. You can download with the PW Upgrade module, or via Github (https://github.com/adrianbj/TracyDebugger) or composer.

The older versions are also available on Github under releases: https://github.com/adrianbj/TracyDebugger/releases

Solved! I could install the module and get the site running.

Now, trying to make a simple test (just echoing a line of html) I have a new problem (possibly my fault?) with error:

Quote

Cannot access non-public property Tracy\FileSession::$file on line: 95 in C:\wamp64\www\cadpp.org\site\modules\TracyDebugger\includes\CodeProcessor.php

 

Posted

Sorry, should be fixed in the latest version.

That's another issue related to your old PHP version that I didn't account for. There have been a lot of changes recently and I just haven't tested on all version combinations.

BTW - you really should be upgrading PHP - 8.0 hasn't had security updates in 2.5 years now.

Posted

Solved! (apparently...)

I downloaded PHP 8.1.34 and 8.2.30 for Wampserver.

8.2.30 raises some problems and errors on PW and/or some modules.

With 8.1.34 Tracy stops complaining and shows no errors. I need more time to check out effects on other modules.

Thank you, Adrian

Posted

8.2 is also past its end of life and isn't getting bug fixes anymore. Just go to at least 8.4, if not 8.5.

Did the very latest version of Tracy still have issues with 8.0? I fixed the last one you reported - did you see more errors?

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
  • Recently Browsing   0 members

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