alphasion 2012-05-25 17:35:49 6084次浏览 3条回复 0 0 0

PHP warning

Illegal string offset 'class'

D:\Portal\Apache2.2\htdocs\protected\extensions\yii-debug-toolbar\YiiDebugToolbar.php(160)

148 
149     /**
150      * Create panels.
151      *
152      * @return YiiDebugToolbar
153      */
154     private function createPanels()
155     {
156         foreach ($this->getPanels() as $id => $config)
157         {
158             if (!is_object($config))
159             {
160                 isset($config['class']) || $config['class'] = $id;
161                 if (isset($config['enabled']) && false === $config['enabled'])
162                 {
163                     unset($this->_panels[$id]);
164                     continue;
165                 }
166                 else if (isset($config['enabled']) && true === $config['enabled'])
167                 {
168                     unset($config['enabled']);
169                 }
170 
171                 $panel = Yii::createComponent($config, $this);
172 
Stack Trace
#0	
–  D:\Portal\Apache2.2\htdocs\protected\extensions\yii-debug-toolbar\YiiDebugToolbar.php(111): YiiDebugToolbar->createPanels()
106         if (false === ($this->owner instanceof CLogRoute))
107         {
108             throw new CException(YiiDebug::t('YiiDebugToolbar owner must be instance of CLogRoute'));
109         }
110 
111         $this->createPanels()
112              ->registerClientScripts();
113     }
114 
115     /**
116      * Run.
#1	
–  D:\Portal\Apache2.2\htdocs\protected\extensions\yii-debug-toolbar\YiiDebugToolbarRoute.php(120): YiiDebugToolbar->init()
115     protected function onBeginRequest(CEvent $event)
116     {
117         $this->initComponents();
118 
119         $this->getToolbarWidget()
120              ->init();
121     }
122 
123     protected function initComponents()
124     {
125         foreach ($this->_proxyMap as $name=>$class)
#2	
+  D:\Portal\Apache2.2\framework\base\CComponent.php(559): YiiDebugToolbarRoute->onBeginRequest(CEvent)
#3	
+  D:\Portal\Apache2.2\framework\base\CApplication.php(189): CComponent->raiseEvent("onBeginRequest", CEvent)
#4	
+  D:\Portal\Apache2.2\framework\base\CApplication.php(161): CApplication->onBeginRequest(CEvent)
#5	
–  D:\Portal\Apache2.2\htdocs\index.php(13): CApplication->run()
08 defined('YII_DEBUG') or define('YII_DEBUG',true);
09 // specify how many levels of call stack should be shown in each log message
10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
11 
12 require_once($yii);
13 Yii::createWebApplication($config)->run();

求指教

  • 回复于 2012-06-14 11:28 举报

    消灭0回复

  • 回复于 2012-06-14 14:29 举报

    因为不能使用实例化的对象来作为数组的索引,或者在使用isset empty检测这样的数据的时候也会出现第二种情况。
    如果在做实际中碰到这样的错误提示,查看数组变量的键名是否使用了实例化的对象变量作为键名

  • 回复于 2012-08-24 15:40 举报

    问题解决了吗?

您需要登录后才可以回复。登录 | 立即注册