Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-30-2008, 03:20 AM
Junior Member
 
Join Date: Jan 2008
Location: Chattanooga area
Posts: 8
Default Exception when using Zend_Loader

Running 1.0.3 on Ubuntu with PHP5 & MySQL5. I have an __autoload($class) that that checks $class for specific classes, and defaults to Zend_Loader::loadClass($class,null). When I comment out the default Zend_Loader, I get the missing index.....phtml as expected because I do not have the view template defined yet, but if I leave it uncommented, then I am getting this error:

Fatal error: Uncaught exception 'Zend_Exception' with message 'File "IndexController.php" was not found' in /var/www/alertusa/_library/Zend/Loader.php:159 Stack trace: #0 /var/www/alertusa/_library/Zend/Loader.php(91): Zend_Loader::loadFile('IndexController...', Array, true) #1 /var/www/alertusa/_include/settings.php(23): Zend_Loader::loadClass('IndexController', NULL) #2 [internal function]: __autoload('IndexController') #3 /var/www/alertusa/_library/Zend/Controller/Dispatcher/Standard.php(165): class_exists('IndexController') #4 /var/www/alertusa/_library/Zend/Controller/Dispatcher/Standard.php(194): Zend_Controller_Dispatcher_Standard->isDispatchable(Object(Zend_Controller_Request_Htt p)) #5 /var/www/alertusa/_library/Zend/Controller/Front.php(929): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #6 /var/www/alertusa/public/index.php(30): Zend_Controller_Front->dispatch() #7 {main} thrown in /var/www/alertusa/_library/Zend/Loader.php on line 159

Anyone have any ideas? Is there more information needed. the settings.php referred to is where the __autoload is along with a few other things and is required_once from the bootstrap. If I comment that out, same thing as if I just comment out the Zend_Loader in the __autoload function.

TIA

Steven
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-30-2008, 06:37 PM
Junior Member
 
Join Date: Dec 2007
Posts: 8
Default

i had the same error, what you need to do is removing your own written custom __autoload() function and using the zend_loader implementation, so instead of using something like this:

function __autoload($class) {
Zend_Loader::loadClass($class);
}

you should be using:

include_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();

if you have specific needs, i suggest you extend zend_loader, and implement your own version of the registerAutoload() method, while still be able to use the parents functionality.

public static function registerAutoload()
{
parent::registerAutoload();
// add your code here
}

Last edited by ignace : 01-30-2008 at 06:40 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-31-2008, 12:10 AM
Junior Member
 
Join Date: Jan 2008
Location: Chattanooga area
Posts: 8
Default

That sounds good. In the __autoload I have defined, there are a couple of conditions that I have where I load the class from other than the include path, and these circumstances do not really use the right naming convention to be handled by registered autoloader, I doubt.

I am trying to integrate the ORM portion of qcodo so I have two conditions, one where the class name begins with "QBase" which requires me to load the main class of the qcodo ORM module, and the other condition is that the class begins with "orm" which is how I set the qcodo to name the data model classes, in which case I would need to load the class from the application/models directory (using the standard directory structure). So, I am presuming the I can do the same thing in the redefined registered autoloader where I first test for thes two conditions and failing those then call the parent method? Does that sound about right?

Thanks for your reply.

Steven
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:16 PM.