randomly unable to include imported CJuiWidget for class extending it

I have this:





Yii::import('zii.widgets.jui.CJuiWidget');

class JqGridView extends CJuiWidget {

  //...

}



and in the view:




$this->widget('application.extensions.jqgrid.JqGridView', array('stuff'=>'more stuff'));



And seem to be randomly getting the error

If I go into JqGridView.php and add a space or something and save it, the page loads just fine again for a while. I use this widget two times (master/slave grids) on two pages, but it only ever does it for the second page. This has left me totally baffled.

The difference between the two pages is on the first page I have another widget before it that also uses CJuiWidget:


$this->widget('ext.kcfinder.KCfinder', array('stuff'));

But it starts the same:





Yii::import('zii.widgets.jui.CJuiWidget');


class KCfinder extends CJuiWidget {

//stuff

}

What can I do to trouble shoot this? I’m not sure if it’s the import that’s failing, or the include path, or what. It’s just peculiar.

Here is the stack trace:







PHP Error


include(CJuiWidget.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory


//stuff//subdomains/test/httpdocs/yii/framework/YiiBase.php(396)


384      * @return boolean whether the class has been loaded successfully

385      */

386 	public static function autoload($className)

387 	{

388 		// use include so that the error PHP file may appear

389 		if(isset(self::$_coreClasses[$className]))

390 			include(YII_PATH.self::$_coreClasses[$className]);

391 		else if(isset(self::$classMap[$className]))

392 			include(self::$classMap[$className]);

393 		else

394 		{

395 			if(strpos($className,'\\')===false)

*396     			include($className.'.php');

397 			else  // class name with namespace in PHP 5.3

398 			{

399     			$namespace=str_replace('\\','.',ltrim($className,'\\'));

400     			if(($path=self::getPathOfAlias($namespace))!==false)

401         			include($path.'.php');

402     			else

403         			return false;

404 			}

405 			return class_exists($className,false) || interface_exists($className,false);

406 		}

407 		return true;

408 	}


Stack Trace

#0 	

+

//stuff//subdomains/test/httpdocs/yii/framework/YiiBase.php(396): YiiBase::autoload()

#1 	

unknown(0): YiiBase::autoload("CJuiWidget")

#2 	

–

//stuff//subdomains/test/httpdocs/yii/framework/YiiBase.php(309): spl_autoload_call("CJuiWidget")


304 			if($isClass)

305 			{

306     			if($forceInclude)

307     			{

308         			if(is_file($path.'.php'))

*309             			require($path.'.php');

310         			else

311             			throw new CException(Yii::t('yii','Alias "{alias}" is invalid. Make sure it points to an existing PHP file.',array('{alias}'=>$alias)));

312         			self::$_imports[$alias]=$className;

313     			}

314     			else


#3 	

+

//stuff//subdomains/test/httpdocs/yii/framework/YiiBase.php(309): YiiBase::import()

#4 	

+

//stuff//subdomains/test/httpdocs/yii/framework/web/CWidgetFactory.php(147): YiiBase::import("application.extensions.jqgrid.JqGridView", true)

#5 	

+

//stuff//subdomains/test/httpdocs/yii/framework/web/CBaseController.php(139): CWidgetFactory->createWidget(CollectionController, "application.extensions.jqgrid.JqGridView", array("htmlOptions" => array("id" => "myGrid", "style" => "float:left;"), "GridNavigator" => array("options" => array("edit" => true), "prmEdit" => array("width" => 400, "closeAfterEdit" => true, "afterSubmit" => "js:afterSubmit", "recreateForm" => true), "prmAdd" => array("width" => 400, "closeAfterEdit" => true, "afterSubmit" => "js:afterSubmit", "recreateForm" => true), "prmDel" => array("afterSubmit" => "js:afterSubmit"), ...), "options" => array("caption" => "Companies", "url" => "/fabric/fabric/collection/index/gajax/1/gname/Company", "editurl" => "/fabric/fabric/collection/index/gajax/1/gname/Company", "datatype" => "json", ...), "columnsModel" => array("columns" => array(array("name" => "Company[company_id]", "editable" => true, "hidden" => true), array("name" => "Company[company_id]", "header" => "Company ID", "editable" => false), array("name" => "Company[company]", "header" => "Company", "type" => "text", "editable" => true)))))

#6 	

+

//stuff//subdomains/test/httpdocs/yii/framework/web/CBaseController.php(165): CBaseController->createWidget("application.extensions.jqgrid.JqGridView", array("htmlOptions" => array("id" => "myGrid", "style" => "float:left;"), "GridNavigator" => array("options" => array("edit" => true), "prmEdit" => array("width" => 400, "closeAfterEdit" => true, "afterSubmit" => "js:afterSubmit", "recreateForm" => true), "prmAdd" => array("width" => 400, "closeAfterEdit" => true, "afterSubmit" => "js:afterSubmit", "recreateForm" => true), "prmDel" => array("afterSubmit" => "js:afterSubmit"), ...), "options" => array("caption" => "Companies", "url" => "/fabric/fabric/collection/index/gajax/1/gname/Company", "editurl" => "/fabric/fabric/collection/index/gajax/1/gname/Company", "datatype" => "json", ...), "columnsModel" => array("columns" => array(array("name" => "Company[company_id]", "editable" => true, "hidden" => true), array("name" => "Company[company_id]", "header" => "Company ID", "editable" => false), array("name" => "Company[company]", "header" => "Company", "type" => "text", "editable" => true)))))

#7 	

–

//stuff//subdomains/test/httpdocs/fabric/protected/modules/fabric/views/collection/index.php(83): CBaseController->widget("application.extensions.jqgrid.JqGridView", array("htmlOptions" => array("id" => "myGrid", "style" => "float:left;"), "GridNavigator" => array("options" => array("edit" => true), "prmEdit" => array("width" => 400, "closeAfterEdit" => true, "afterSubmit" => "js:afterSubmit", "recreateForm" => true), "prmAdd" => array("width" => 400, "closeAfterEdit" => true, "afterSubmit" => "js:afterSubmit", "recreateForm" => true), "prmDel" => array("afterSubmit" => "js:afterSubmit"), ...), "options" => array("caption" => "Companies", "url" => "/fabric/fabric/collection/index/gajax/1/gname/Company", "editurl" => "/fabric/fabric/collection/index/gajax/1/gname/Company", "datatype" => "json", ...), "columnsModel" => array("columns" => array(array("name" => "Company[company_id]", "editable" => true, "hidden" => true), array("name" => "Company[company_id]", "header" => "Company ID", "editable" => false), array("name" => "Company[company]", "header" => "Company", "type" => "text", "editable" => true)))))


20 $this->widget('application.extensions.jqgrid.JqGridView', array(

78         			'type' 		=> 'text', //CFormatter type

79         			'editable' 	=> true,

80     			),

81 		),

82 	),

*83 ));

84 //*/

85 ?>

86 </div>

87 <div class='form' style="float:right;">

88 <?php


#8 	

+

//stuff//subdomains/test/httpdocs/yii/framework/web/CBaseController.php(119): require("//stuff//subdomains/test/httpdocs/fabric/pr...")

#9 	

+

//stuff//subdomains/test/httpdocs/yii/framework/web/CBaseController.php(88): CBaseController->renderInternal("//stuff//subdomains/test/httpdocs/fabric/pr...", array(), true)

#10 	

+

//stuff//subdomains/test/httpdocs/yii/framework/web/CController.php(866): CBaseController->renderFile("//stuff//subdomains/test/httpdocs/fabric/pr...", array(), true)

#11 	

+

//stuff//subdomains/test/httpdocs/yii/framework/web/CController.php(779): CController->renderPartial("index", array(), true)

#12 	

–

//stuff//subdomains/test/httpdocs/fabric/protected/modules/fabric/controllers/CollectionController.php(174): CController->render("index", array())


169 

170 		//$model=new Fabric('search');

171 		

172 		$this->render('index',array(

173 //            'model'=>$this->loadModel($id),

*174 		));

175 	}

176 

177 

178 	public function getGridAjax($gname) {

179 		


#13 	

unknown(0): CollectionController->actionIndex(false, null)

#14 	

+

//stuff//subdomains/test/httpdocs/yii/framework/web/actions/CAction.php(104): ReflectionMethod->invokeArgs(CollectionController, array(false, null))

#15 	

+

//stuff//subdomains/test/httpdocs/yii/framework/web/actions/CInlineAction.php(48): CAction->runWithParamsInternal(CollectionController, ReflectionMethod, array())

#16 	

+

//stuff//subdomains/test/httpdocs/yii/framework/web/CController.php(300): CInlineAction->runWithParams(array())

#17 	

+

//stuff//subdomains/test/httpdocs/yii/framework/web/filters/CFilterChain.php(133): CController->runAction(CInlineAction)

#18 	

+

//stuff//subdomains/test/httpdocs/yii/framework/web/filters/CFilter.php(41): CFilterChain->run()

#19 	

+

//stuff//subdomains/test/httpdocs/yii/framework/web/CController.php(1122): CFilter->filter(CFilterChain)

#20 	

+

//stuff//subdomains/test/httpdocs/yii/framework/web/filters/CInlineFilter.php(59): CController->filterAccessControl(CFilterChain)

#21 	

+

//stuff//subdomains/test/httpdocs/yii/framework/web/filters/CFilterChain.php(130): CInlineFilter->filter(CFilterChain)

#22 	

+

//stuff//subdomains/test/httpdocs/yii/framework/web/CController.php(283): CFilterChain->run()

#23 	

+

//stuff//subdomains/test/httpdocs/yii/framework/web/CController.php(257): CController->runActionWithFilters(CInlineAction, array("accessControl"))

#24 	

+

//stuff//subdomains/test/httpdocs/yii/framework/web/CWebApplication.php(328): CController->run("")

#25 	

+

//stuff//subdomains/test/httpdocs/yii/framework/web/CWebApplication.php(121): CWebApplication->runController("fabric/collection")

#26 	

+

//stuff//subdomains/test/httpdocs/yii/framework/base/CApplication.php(155): CWebApplication->processRequest()

#27 	

–

//stuff//subdomains/test/httpdocs/fabric/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();


2011-04-11 12:25:49 Apache/2.2.3 (Red Hat) Yii Framework/1.1.7




PHP 5.2.14

Ideas?

Got the same problem, have you found solution yet?

This thread looks like it has the fix:

http://www.yiiframework.com/forum/index.php?/topic/7161-strange-include-error-with-zii-jui-widgets/