php - Yii: Unexpected invocation of CHttpSession::close when running a method in custom class -
strange problem here. using yii framework have following class
class htmltableui { public function __construct(cwebmodule &$module,$data,$actions) { //...code goes here... } protected function rendertable() { //... code goes here ... } } i can call htmltableui::rendertable() instance of htmltableui in schedulermodule class main class in separate application module. schedulermodule.php file:
<?php yii::import('scheduler.components.htmltableui'); class schedulermodule extends cwebmodule { public function init() { parent::init(); } public function beforecontrolleraction($controller, $action) { return true; } public function printui($data,$actions,$submitpath) { $ui = new htmltableui($this,$data,$actions,$submitpath); $ui->rendertable(); } } here comes tricky part - when call schudulermodule::printui view (index.php) way
<?php $this->module->printui($casino,$actions,null); ?> the code flow goes through schudulermodule::printui until reaching point rendertable invoked ($ui->rendertable();) , instead stepping @ first line inside body of method it, contrary logic , rules, surprisingly jumps chttpsession::close !!?
notice call stack before invoking rendertable
protected/modules/scheduler/schedulermodule.php.schedulermodule->printui:153 protected/modules/scheduler/views/default/index.php.require:21 /home/default/workspace/src/vlt/web/yii-1.1.12.b600af/framework/web/cbasecontroller.php.cbasecontroller->renderinternal:127 /home/default/workspace/src/vlt/web/yii-1.1.12.b600af/framework/web/cbasecontroller.php.cbasecontroller->renderfile:96 /home/default/workspace/src/vlt/web/yii-1.1.12.b600af/framework/web/ccontroller.php.ccontroller->renderpartial:870 /home/default/workspace/src/vlt/web/yii-1.1.12.b600af/framework/web/ccontroller.php.ccontroller->render:783 protected/modules/scheduler/controllers/defaultcontroller.php.defaultcontroller->actionindex:57 and after:
/home/default/workspace/src/vlt/web/yii-1.1.12.b600af/framework/web/chttpsession.php.chttpsession->close:134 /home/default/workspace/src/vlt/web/yii-1.1.12.b600af/framework/web/chttpsession.php.schedulermodule->printui:0 protected/modules/scheduler/views/default/index.php.require:21 /home/default/workspace/src/vlt/web/yii-1.1.12.b600af/framework/web/cbasecontroller.php.cbasecontroller->renderinternal:127 /home/default/workspace/src/vlt/web/yii-1.1.12.b600af/framework/web/cbasecontroller.php.cbasecontroller->renderfile:96 /home/default/workspace/src/vlt/web/yii-1.1.12.b600af/framework/web/ccontroller.php.ccontroller->renderpartial:870 /home/default/workspace/src/vlt/web/yii-1.1.12.b600af/framework/web/ccontroller.php.ccontroller->render:783 protected/modules/scheduler/controllers/defaultcontroller.php.defaultcontroller->actionindex:57 has had similar issue? can explain behavior?
i found solution!!! access modifier of rendertable supposed public, not protected. wrong somehow in yii framework results in unexpected runtime behavior instead of compilation error.
Comments
Post a Comment