debug_kit icon indicating copy to clipboard operation
debug_kit copied to clipboard

Handling exceptions more graceful

Open dereuromark opened this issue 8 months ago • 2 comments

Currently, when there is sth wrong, the custom panel just shows

[Warning (2) ](javascript:void(0);): Undefined variable $authenticationProvider 
[in /shared/httpd/app/vendor/dereuromark/cakephp-tinyauth/templates/element/auth_panel.php, line 68]

and many more

Which would be impossible if the AuthPanel class would run properly as those data would be passed down

Only by debugging the template and dd($this->viewVars) you find out that:

ROOT/vendor/dereuromark/cakephp-tinyauth/templates/element/auth_panel.php (line 21)
[
'error' => 'Serialization of 'Closure' is not allowed',
'panel' => object(DebugKit\Model\Entity\Panel) id:0 { },
'sort' => null,
]

but with no clear message on where and what

dereuromark avatar Jun 05 '25 10:06 dereuromark

It seems data() still contains everything, but then afterwards it fails.

ROOT/vendor/dereuromark/cakephp-tinyauth/src/Panel/AuthPanel.php (line 126)
[
'params' => [ ],
'path' => 'Admin/Overview',
'availableRoles' => [ ],
'user' => [ ],
'roles' => [ ],
'config' => [ ],
'access' => [ ],
'identity' => object(Authorization\Identity) id:5 { },
'authenticationProvider' => object(TinyAuth\Authenticator\PrimaryKeySessionAuthenticator) id:12 { },
'identificationProvider' => object(Authentication\Identifier\TokenIdentifier) [id: 14](http://ww.local/admin#cake-db-object-68417089c37f99.24774647-14) {},
'isPublic' => false,
]

Why wouldnt it just pass down the array and instead tries to serialize sth?

I was able to find out it is those two

	$data['authenticationProvider'] = $auth ? $auth->getAuthenticationProvider() : null;
	$data['identificationProvider'] = $auth ? $auth->getIdentificationProvider() : null;

causing it then in the end

dereuromark avatar Jun 05 '25 10:06 dereuromark

Why wouldnt it just pass down the array and instead tries to serialize sth?

Panel content has to be serializable for the history to work.

markstory avatar Jun 08 '25 14:06 markstory

I guess not much possible here then.

dereuromark avatar Jul 16 '25 22:07 dereuromark