Friday, November 21, 2008

Sementation fault with $uses variable in app_controller

Tonight, my Apache instance (OSX 10.5.5 Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l DAV/2 PHP/5.2.5 ) threw a segmentation fault when I tried to use one of my Models from the app_controller. In my code, this is how I had this setup:


class AppController extends Controller {
var $helpers = array('Html', 'Javascript', 'ForLayout', 'Tree');
var $components = array('Session', 'obAuth', 'Cookie');
var $uses = array('Contentpage'); /* THIS IS THE OFFENDING LINE */
...
}

I discovered this by systematically commenting out every piece of code that was implementing my Contentpage model. When I commented out the $uses variable, the segmentation fault went away.

So now my code reads like this to remind me.


class AppController extends Controller {
var $helpers = array('Html', 'Javascript', 'ForLayout', 'Tree');
var $components = array('Session', 'obAuth', 'Cookie');
/*
* WARNING!!! THIS CAUSES A SEGMENTATION FAULT!! DO NOT USE!!!
* var $uses = array('Contentpage');
*
*/
...
}


I've seen some issues in the CakePHP trac regarding segmentation faults, but nothing of this exact same nature.

As a side note, I thought I would try to use it from another controller. Initially this worked fine, but when it ran functions inside of obAuth, I got very unpredictable results. I'm still not really sure exactly what the nature of that error was. While I was debugging this, the segmentation fault started up again.

At any rate, I found a way to work around this so it doesn't hinder my work by putting a different layout on the controllers and actions that I originally wanted this functionality to execute on. However, I'm not sure what I'll do if I need a Model available to the app controller.

Has anyone else had this issue?

No comments:

Post a Comment