doxp30826 2013-01-16 18:44 采纳率: 0%
浏览 39
已采纳

'Zend_Exception' - >'注册表已初始化'

Here is my complete error:

Strict Standards: Accessing static property Bootstrap::$frontController as non static in /Users/panda/Dropbox/www/_playground/myApp/Zend/Application/Resource/Frontcontroller.php on line 145

Fatal error: Uncaught exception 'Zend_Exception' with message 'Registry is already initialized' in /Users/panda/Dropbox/www/_playground/myApp/Zend/Registry.php:70 Stack trace: #0 /Users/panda/Dropbox/www/_playground/myApp/application/Bootstrap.php(217): Zend_Registry::setInstance(Object(Zend_Registry)) #1 /Users/panda/Dropbox/www/_playground/myApp/application/Bootstrap.php(56): Bootstrap->_initSetupRegistry() #2 /Users/panda/Dropbox/www/_playground/myApp/Zend/Application/Bootstrap/BootstrapAbstract.php(669): Bootstrap->_initPrepare() #3 /Users/panda/Dropbox/www/_playground/myApp/Zend/Application/Bootstrap/BootstrapAbstract.php(622): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('prepare') 4 /Users/panda/Dropbox/www/_playground/myApp/Zend/Application/Bootstrap/BootstrapAbstract.php(586): Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap(NULL) #5 /Users/panda/Dropbox/www/_playground/myApp/Zend/Application.php(355): Zend_Application_Bootstrap_BootstrapAbstract->bootstrap(NULL) #6 in /Users/panda/Dropbox/www/_playground/myApp/Zend/Registry.php on line 70

Here is the function from my bootstrap

/*
* Zend_Registry get's born here so it can be accesed
*/
protected function _initSetupRegistry()
{

    self::$registry = new Zend_Registry(array(), ArrayObject::ARRAY_AS_PROPS);
    Zend_Registry::setInstance(self::$registry);

}

If you need more code, please let me know, I will like some tips for finding the problem, or if someone knows the exact problem.

Thank you!

  • 写回答

1条回答 默认 最新

  • douqingnao9246 2013-01-16 18:48
    关注

    What are you trying to achieve with this method?

    If you just want an instance of the registry use Zend_Registry::getInstance(). You shouldn't be constructing it (I'm not sure why they used a singleton pattern but didn't make __construct private).

    If you really want to replace an instance of Zend_Registry call Zend_Registry::_unsetInstance() first.

    If you just want to set the static $registry variable so you can reference it later try:

    self::$registry = Zend_Registry::getInstance(); 
    self::$registry->set('configuration', 'myconfig');
    

    But I'm not sure this is necessary because you can access Zend_Registry::getInstance() from any scope. So the above is the same as:

    Zend_Registry::getInstance()->set('configuration', 'myconfig');
    

    Which you can call anywhere.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 在不同的执行界面调用同一个页面
  • ¥20 基于51单片机的数字频率计
  • ¥50 M3T长焦相机如何标定以及正射影像拼接问题
  • ¥15 keepalived的虚拟VIP地址 ping -s 发包测试,只能通过1472字节以下的数据包(相关搜索:静态路由)
  • ¥20 关于#stm32#的问题:STM32串口发送问题,偶校验(even),发送5A 41 FB 20.烧录程序后发现串口助手读到的是5A 41 7B A0
  • ¥15 C++map释放不掉
  • ¥15 Mabatis查询数据
  • ¥15 想知道lingo目标函数中求和公式上标是变量情况如何求解
  • ¥15 关于E22-400T22S的LORA模块的通信问题
  • ¥15 求用二阶有源低通滤波将3khz方波转为正弦波的电路