Closed geoidesic closed 4 years ago
How can someone reproduce this problem?
@geoidesic Can you give us more information?
Dunno. I can't replicate it now either. I'll re-open with more info if it recurs.
LOL. As I entered that, it happened again :D
So here's what I did:
php /usr/local/bin/composer create-project --prefer-dist cakephp/app:^3.8 testCake3
It stops on line 96 of PackageLocator.php with that error.
It is intermittent though. Just tried it a few more times and now I'm not getting it.
What is full callstack?
What message does it tries to translate (look for __d()
few frames before PackageLocator.php
)?
It doesn't give me a call stack. The error shows only in the IDE when it hits the error and the step through stops – and there's no call stack given, just the exception message. It's very strange... it also doesn't seem to take me on the same step-through route every request. Looks like it's getting stuck on translations, but only sometimes. Seems to happen something like 1 out of 3 or 4 requests.
Something else that's odd is that bootstrap seems to be run twice by the request. I have a breakpoint in there and it gets hit twice by each request.
Add breakpoint on line 96 of PackageLocator.php so it stops before throwing exception.
Callstack and message to translate might give a hint why.
It might be cached by Cake cache for short time and it happen or not.
Bootstrap is called twice because one for app request and one to load iframe of DebugKit toolbar. Check URL in $_SERVER
in the debugger.
Ok found the call stack:
Aura\Intl\PackageLocator->get (/Users/me/testCake3/vendor/aura/intl/src/PackageLocator.php:96)
Cake\I18n\TranslatorRegistry->get (/Users/me/testCake3/vendor/aura/intl/src/TranslatorLocator.php:180)
Cake\I18n\TranslatorRegistry->_getTranslator (/Users/me/testCake3/vendor/cakephp/cakephp/src/I18n/TranslatorRegistry.php:167)
Cake\I18n\TranslatorRegistry->get (/Users/me/testCake3/vendor/cakephp/cakephp/src/I18n/TranslatorRegistry.php:149)
Cake\I18n\I18n::getTranslator (/Users/me/testCake3/vendor/cakephp/cakephp/src/I18n/I18n.php:209)
__d (/Users/me/testCake3/vendor/cakephp/cakephp/src/I18n/functions.php:88)
DebugKit\Panel\TimerPanel->DebugKit\Panel\{closure:/Users/me/testCake3/vendor/cakephp/debug_kit/src/Panel/TimerPanel.php:52-54} (/Users/me/testCake3/vendor/cakephp/debug_kit/src/Panel/TimerPanel.php:53)
Cake\Event\EventManager->_callListener (/Users/me/testCake3/vendor/cakephp/cakephp/src/Event/EventManager.php:352)
Cake\Event\EventManager->dispatch (/Users/me/testCake3/vendor/cakephp/cakephp/src/Event/EventManager.php:329)
App\Controller\PagesController->dispatchEvent (/Users/me/testCake3/vendor/cakephp/cakephp/src/Event/EventDispatcherTrait.php:113)
App\Controller\PagesController->startupProcess (/Users/me/testCake3/vendor/cakephp/cakephp/src/Controller/Controller.php:676)
Cake\Http\ActionDispatcher->_invoke (/Users/me/testCake3/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php:115)
Cake\Http\ActionDispatcher->dispatch (/Users/me/testCake3/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php:94)
App\Application->__invoke (/Users/me/testCake3/vendor/cakephp/cakephp/src/Http/BaseApplication.php:234)
Cake\Http\Runner->__invoke (/Users/me/testCake3/vendor/cakephp/cakephp/src/Http/Runner.php:65)
Cake\Http\Runner->__invoke (/Users/me/testCake3/vendor/cakephp/cakephp/src/Http/Runner.php:65)
Cake\Http\Middleware\CsrfProtectionMiddleware->__invoke (/Users/me/testCake3/vendor/cakephp/cakephp/src/Http/Middleware/CsrfProtectionMiddleware.php:124)
Cake\Http\Runner->__invoke (/Users/me/testCake3/vendor/cakephp/cakephp/src/Http/Runner.php:65)
Cake\Http\Runner->run (/Users/me/testCake3/vendor/cakephp/cakephp/src/Http/Runner.php:51)
Cake\Routing\Middleware\RoutingMiddleware->__invoke (/Users/me/testCake3/vendor/cakephp/cakephp/src/Routing/Middleware/RoutingMiddleware.php:168)
Cake\Http\Runner->__invoke (/Users/me/testCake3/vendor/cakephp/cakephp/src/Http/Runner.php:65)
Cake\Routing\Middleware\AssetMiddleware->__invoke (/Users/me/testCake3/vendor/cakephp/cakephp/src/Routing/Middleware/AssetMiddleware.php:88)
Cake\Http\Runner->__invoke (/Users/me/testCake3/vendor/cakephp/cakephp/src/Http/Runner.php:65)
Cake\Error\Middleware\ErrorHandlerMiddleware->__invoke (/Users/me/testCake3/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php:96)
Cake\Http\Runner->__invoke (/Users/me/testCake3/vendor/cakephp/cakephp/src/Http/Runner.php:65)
DebugKit\Middleware\DebugKitMiddleware->__invoke (/Users/me/testCake3/vendor/cakephp/debug_kit/src/Middleware/DebugKitMiddleware.php:53)
Cake\Http\Runner->__invoke (/Users/me/testCake3/vendor/cakephp/cakephp/src/Http/Runner.php:65)
Cake\Http\Runner->run (/Users/me/testCake3/vendor/cakephp/cakephp/src/Http/Runner.php:51)
Cake\Http\Server->run (/Users/me/testCake3/vendor/cakephp/cakephp/src/Http/Server.php:97)
{main} (/Users/me/testCake3/webroot/index.php:40)
The string it's trying to translate is Controller initialization
and $domain
= debug_kit
The string it's trying to translate is Controller initialization and $domain = debug_kit
We are getting rid of that translation function usage anyway https://github.com/cakephp/debug_kit/pull/750/files
@ADmad PR is for 4.x, not 3.x, so it won't help here.
I'm not sure why exception is not catched here https://github.com/cakephp/cakephp/blob/3.8.11/src/I18n/TranslatorRegistry.php#L166-L169 Or is it thrown again in fallback loader few lines later.
I'm unable to repeat so it is hard to tell why.
But I guess it is something with cache. In debug mode, it is 2 minutes, try shorter duration, it should happen more often.
@garas We can backport it.
It's highly likely the issue is with a particular environment and not a bug in our code.
Hi,
I'm getting this error when stepping through the code using Xdebug.
This is a Standard CakePHP 3.x installation
Is there a fix for this?