Hi,
I have created a wesite that uses partials on certain pages. The whole
thing worked fine on the local test server but when I migrated over to the
production server i got a very stange error that I can't track down.
Basically it says:
Fatal error: Cannot redeclare class zend_view_helper_partial in
/home/sam/dolphin2008.co.uk/application/library/Zend/View/Helper/Partial.php
on line 32
I understand what the error message means. What I don't understand is how
it only sometimes happens. All of the classes are included by a class which
extends Zend_Loader so it must be Zned_Loader which is the cause.
I am extending Zend_Loader with the following class:
class My_Loader extends Zend_Loader
{
public static function loadClass($class, $dirs = null)
{
parent::loadClass($class, $dirs);
}
public static function autoload($class)
{
try {
self::loadClass($class);
return $class;
} catch (Exception $e) {
$filename = str_replace("_", "/", $class) . '.php';
if(is_readable(APP_PATH . 'models/'.$filename))
{
include APP_PATH . 'models/'.$filename;
}
else
{
throw $e;
}
}
}
}
As you can see, its a basic class that tries the normal 'loadClass' method
and if this fails it then searches through my models directory to find the
right class.
But Zend_View_Helper_Partial is part of the core library. I never extend
this class.... and I am using it as per the documentation. But for some
reason Zend_Loader tries to included it twice (I assume) and produced the
error as described above.
Even more confusingly if I simply restart apache the error goes away.
Has anyone received similar errors?
Can someone who is more familiar with Zend_Loader or the spl_autoload work
out what is happening here?
Cheers,
Sam
--
View this message in context:
http://www.nabble.com/Cannot-redeclare-class-Zend_Loader--%3E-Zend-View-Helper-Partial-tp18710136p18710136.html
Sent from the Zend Framework mailing list archive at Nabble.com.