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

3.16.0: undefined index: classname #627

Closed
smarek opened this Issue May 22, 2018 · 7 comments

Comments

Projects
None yet
3 participants
@smarek
Copy link

smarek commented May 22, 2018

Notice (8): Undefined index: className [ROOT/vendor/cakephp/debug_kit/src/Panel/CachePanel.php, line 42]
Code Context
$name = '_cake_routes_'
$config = [
	'duration' => '+2 seconds'
]
$instance = object(DebugKit\Cache\Engine\DebugEngine) {
	[protected] _config => [
		'className' => 'File',
		'prefix' => 'myapp_cake_model_',
		'path' => '/var/www/dotacni-parazit.cz/tmp/cache/models/',
		'serialize' => true,
		'duration' => '+2 minutes',
		'url' => null
	]
	[protected] _engine => null
	[protected] _metrics => [
		'write' => (int) 0,
		'delete' => (int) 0,
		'read' => (int) 0,
		'hit' => (int) 0,
		'miss' => (int) 0
	]
	[protected] _defaultConfig => [
		'duration' => (int) 3600,
		'groups' => [[maximum depth reached]],
		'prefix' => 'cake_',
		'probability' => (int) 100,
		'warnOnWriteFailures' => true
	]
	[protected] _groupPrefix => null
	[protected] _configInitialized => false
}
Cake\Core\Plugin::{closure}() - ROOT/vendor/cakephp/debug_kit/config/bootstrap.php, line 41
DebugKit\Panel\CachePanel::initialize() - ROOT/vendor/cakephp/debug_kit/src/Panel/CachePanel.php, line 42
DebugKit\ToolbarService::initializePanels() - ROOT/vendor/cakephp/debug_kit/src/ToolbarService.php, line 194
DebugKit\Middleware\DebugKitMiddleware::__invoke() - ROOT/vendor/cakephp/debug_kit/src/Middleware/DebugKitMiddleware.php, line 52
Cake\Http\Runner::__invoke() - CORE/src/Http/Runner.php, line 65
Cake\Http\Runner::run() - CORE/src/Http/Runner.php, line 51
Cake\Http\Server::run() - CORE/src/Http/Server.php, line 98
[main] - ROOT/webroot/index.php, line 40

I didn't find any related documentation, on which configuration I am missing, there is no special configuration for Datasource for DebugKit, so it should default to SQLite (ii php7.0-sqlite3 7.0.27-0+deb9u1 amd64 SQLite3 module for PHP).

However it can be rid of by disabling CachePanel, using

Configure::write('DebugKit.panels', ['DebugKit.Cache' => false]);
@saeideng

This comment has been minimized.

Copy link
Member

saeideng commented May 22, 2018

check your cache config in /config/app.php
see config for _cake_routes_

probably you are using wrong className

        '_cake_routes_' => [
            'className' => 'File',
            'prefix' => 'myapp_cake_routes_',
            'path' => CACHE,
            'serialize' => true,
            'duration' => '+1 years',
            'url' => env('CACHE_CAKEROUTES_URL', null),
        ],
@smarek

This comment has been minimized.

Copy link

smarek commented May 22, 2018

Oh, I've upgraded from 3.4 to 3.6 and this I missed, the _cake_routes_ wasn't defined at all. After adding and re-enabling the CachePanel, it seems to work ok :)

Maybe add some kind of check if this config is even available, or documentation on CachePanel depending on it?

Thank you!

@markstory markstory self-assigned this May 22, 2018

@markstory

This comment has been minimized.

Copy link
Member

markstory commented May 22, 2018

I'll take a look. There shouldn't be an error when the cache engine is undefined.

@markstory markstory added this to the 3.x milestone May 22, 2018

@markstory markstory added the defect label May 22, 2018

@saeideng

This comment has been minimized.

Copy link
Member

saeideng commented May 22, 2018

the _cake_routes_ wasn't defined at all.

in this case , and when you are using
->add(new RoutingMiddleware($this, '_cake_routes_'));
you should receive an error/exception

The "_cake_routes_" cache configuration does not exist.

https://github.com/cakephp/cakephp/blob/0e76d16ed9c2ebd209d5071395b3347a85d3acb2/src/Cache/Cache.php#L159-L167

@markstory

This comment has been minimized.

Copy link
Member

markstory commented May 23, 2018

@saeideng Sure, but the stack trace posted earlier by @smarek doesn't contain RoutingMiddleware at all.

@markstory

This comment has been minimized.

Copy link
Member

markstory commented May 23, 2018

Pull request up now.

@markstory markstory closed this May 23, 2018

@smarek

This comment has been minimized.

Copy link

smarek commented May 23, 2018

@markstory thank you, you're the best!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment