Jump to content

Error on installing/updating Tracy Debugger


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?

Posted

Quick test with PHP versions:

PHP8.0.30 -- test <?php echo "<p>que chatice</p>" ?> -- result: "Exception: Cannot access non-public property Tracy\FileSession::$file on line: 95 in C:\wamp64\www\cadpp.org\site\modules\TracyDebugger\includes\CodeProcessor.php"

PHP8.5.6 -- seems to work ok in general and with Tracy, but some modules seem to need adaptation to the new PHP version:
Errors resulting from deprecated instructions in some modules:

 
Deprecated: mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in ...\TextformatterFluidImages\TextformatterFluidImages.module:52
 
Deprecated: Use of "self" in callables is deprecated in ...\TextformatterSoundmanager\TextformatterSoundmanager.module:582
Deprecated: mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in ...\TextformatterFluidImages\TextformatterFluidImages.module:52

Once again, thank you for your titanic effort to adapt Trac to PW!

Posted
2 minutes ago, RuiVP said:

PHP8.0.30 -- test <?php echo "<p>que chatice</p>" ?> -- result: "Exception: Cannot access non-public property Tracy\FileSession::$file on line: 95 in C:\wamp64\www\cadpp.org\site\modules\TracyDebugger\includes\CodeProcessor.php"

Did my commit yesterday (https://github.com/adrianbj/TracyDebugger/commit/b1f784a669f24b8b7409d192c7e4659ca1b0618f) not fix this?

You will see some deprecations in other modules, but that's just part of the process - please report these to the module authors.

Posted

Sorry, you are too fast for me...

Now, I uploaded your new version and went back to PHP8.030. Everything looks fine. Plus, other modules stopped complaining with this PHP version.

Posted

Ok glad Tracy is fixed, but I would strongly advise against using PHP 8.0 - no security updates isn't worth it. Just report the issues to those module authors and deal with the deprecation warnings until they are fixed (or fix them yourself locally in the meantime).

  • Like 1

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...