Friday, October 1, 2010

Tracking down WSOD: Some problems with users controller and acl component

Hi everybody

I'm having another nasty white screen of death and I'm tracking it
down right now. I came down to the following...

I'm having a UsersController that uses the Acl component. When trying
to create/update a user (after submitting the form) i get the feared
WSOD.

The execution of my code seems to break in cake/libs/controller/
component.php in the method triggerCallback(...)

The original method looks like this:

function triggerCallback($callback, &$controller) {
foreach ($this->_primary as $name) {
$component =& $this->_loaded[$name];
if (method_exists($component, $callback) && $component->enabled ===
true) {
$component->{$callback}($controller);
}
}
}

For debugging purposes I added a die(...) statement:

function triggerCallback($callback, &$controller) {
foreach ($this->_primary as $name) {
$component =& $this->_loaded[$name];
if (method_exists($component, $callback) && $component->enabled ===
true) {
die("component: {$component}<br/
>callback: {$callback}<br/>controller: {$controller}");
$component->{$callback}($controller);
}
}
}

And the output is:

Warning (4096): Object of class AclComponent could not be converted to
string [CORE/cake/libs/controller/component.php, line 185]

Component::triggerCallback() - CORE/cake/libs/controller/
component.php, line 185
Controller::startupProcess() - CORE/cake/libs/controller/
controller.php, line 527
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 187
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171
[main] - APP/webroot/index.php, line 83

Warning (4096): Object of class UsersController could not be converted
to string [CORE/cake/libs/controller/component.php, line 185]

Component::triggerCallback() - CORE/cake/libs/controller/
component.php, line 185
Controller::startupProcess() - CORE/cake/libs/controller/
controller.php, line 527
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 187
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171
[main] - APP/webroot/index.php, line 83

component:
callback: startup
controller:

It looks very strange to me that $component is empty and $controller
is empty too, but I'm also quite surprised that actually there is even
more output now (the two warnings) where there haven't been warnings
before but only a WSOD! AND I'm very surprised that these warnings
haven't been written to the error.log before (when WSOD appeared) but
are written now (when using die(...)). This isn't a feature, is it?

Well, despite knowing a bit more now, I don't really know how to fix
this. Maybe the UsersController code would help? It's quite long and
*very* dirty (it's not mine, I've taken it over from my preceeder, and
I'm working on cleaning it right now), so I uploaded it rather than
putting it here into the text:

(argh, my webserver's got problems right now, I will try and upload it
a bit later...)

Well, any help would be highly appreciated. I tried tracking stuff
down, but I'm not that versatile with CakePHP yet, so I'm stuck.

Thanks and have a nice weekend, guys :-)
Josh

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: