Friday, October 1, 2010

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

On Fri, Oct 1, 2010 at 11:21 AM, psybear83 <psybear83@gmail.com> wrote:
> 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?

You're chasing a red herring. Look at the warning again--it's telling
you that the OBJECT cannot be converted to a string (ie. in the die()
line that you added). The warnings are only now appearing because
they're a direct result of your debugging attempts, not a clue as to
the original problem. The reason nothing is printed for $component &
$controller is clearly stated in the warning.

What led you to believe the trouble is rooted in triggerCallback()?

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: