3

I am using Zend Debugger to debug my php application built based on the Zend Framework. Currently I am running the 1.10.6 version. When debugging my application i Get this error:

Compile Error: /var/www/Zend/ZendFramework-1.10.6/library/Zend/Loader/Autoloader.php line 36 - Cannot redeclare class Zend_Loader_Autoloader

Is this just a bug in the Zend Framework or does it have anything to do with a misconfiguration in my application.php?

$paths = array(

    realpath(dirname(__FILE__).'/../library'),
    '.',
);
*/


defined('APPLICATION_PATH') 
    or define('APPLICATION_PATH', realpath(dirname(__FILE__).'/../application'));
defined('APPLICATION_ENV')
    or define('APPLICATION_ENV', 'development');

set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH.'/../library'),
)));    


//require_once('Zend/Loader/Autoloader.php');   
require_once('Zend/Application.php');

$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH.'/configs/events.ini'  
);

$application->bootstrap()->run();
sanders
  • 10,794
  • 27
  • 85
  • 127
  • Probably the error is with the configuration of Zend Debugger. I already have this error when testing Zend Debugger. The bad thing is that I've not solved this... When testing, my application had no errors. – Keyne Viana Jul 29 '10 at 16:57
  • well it terminates my debug session when i jump over it. So I HAVE to solve this issue first – sanders Jul 29 '10 at 17:00
  • What I'm suggesting you is to look at the debugger, not the code, this errors occurs not only with the autoloader. For example, take a look at this: http://zend-framework-community.634137.n4.nabble.com/Using-Zend-Studio-5-5-0-Debugger-td644517.html http://markmail.org/message/xyyntiwkfja2awya I've nerver seen the solution for this issues. – Keyne Viana Jul 29 '10 at 17:12

3 Answers3

3

turn off zend optimizer if you are using zend server

citiface
  • 31
  • 1
2

Perhaps you're include()-ing or require()-ing the file somewhere without knowing it. Try sticking this code at the top of Autoloader.php:

if (!isset($GLOBALS['zend_autoloader_loaded'])) {
    $GLOBALS['zend_autoloader_loaded'] = true;
}
else {
    print_r(debug_backtrace());
    die;
}

The trace will indicate where Autoloader.php is being required for the 2nd time.

Adam
  • 2,110
  • 3
  • 14
  • 17
1

Perhaps your using Zend Server - which I think includes this by default.

Ian Warner
  • 1,058
  • 13
  • 32