getIsSecureConnection in 1.05 to 1.1 upgrade PROBLEM!!!

I use getIsSecureConnection to recognise http/https connection in my application with Yii 1.0.5. It works OK.

After upgrade to 1.1.0 (r. 1700) I’m disappointed with the problem in above function - it is unknown by SiteController:

The code (fragment of .../protected/views/site/index.php):

[i][b]

[size="4"]if($secure=$this->getIsSecureConnection()) {…[/size][/b][/i]

The CExcepion listing:

CException

Description

SiteController does not have a method named "getIsSecureConnection".

Source File

/home/gbk/Instalki/yii-1.1.0.r1700/framework/base/CComponent.php(237)

00225: * @since 1.0.2

00226: */

00227: public function __call($name,$parameters)

00228: {

00229: if($this->_m!==null)

00230: {

00231: foreach($this->_m as $object)

00232: {

00233: if($object->getEnabled() && method_exists($object,$name))

00234: return call_user_func_array(array($object,$name),$parameters);

00235: }

00236: }

[size=“4”]00237: throw new CException(Yii::t(‘yii’,’{class} does not have a method named “{name}”.’,[/size]

00238: array(’{class}’=>get_class($this), ‘{name}’=>$name)));

Stack Trace

#0 [internal function]: CComponent->__call(‘getIsSecureConn…’, Array)

#1 /home/gbk/Instalki/Projekty_Symfony/ipoba/web/protected/views/site/index.php(4): SiteController->getIsSecureConnection()

#2 /home/gbk/Instalki/yii-1.1.0.r1700/framework/web/CBaseController.php(119): require(’/home/gbk/Insta…’)

#3 /home/gbk/Instalki/yii-1.1.0.r1700/framework/web/CBaseController.php(88): CBaseController->renderInternal(’/home/gbk/Insta…’, NULL, true)

#4 /home/gbk/Instalki/yii-1.1.0.r1700/framework/web/CController.php(732): CBaseController->renderFile(’/home/gbk/Insta…’, NULL, true)

#5 /home/gbk/Instalki/yii-1.1.0.r1700/framework/web/CController.php(671): CController->renderPartial(‘index’, NULL, true)

#6 /home/gbk/Instalki/Projekty_Symfony/ipoba/web/protected/controllers/SiteController.php(32): CController->render(‘index’)

#7 /home/gbk/Instalki/yii-1.1.0.r1700/framework/web/actions/CInlineAction.php(32): SiteController->actionIndex()

#8 /home/gbk/Instalki/yii-1.1.0.r1700/framework/web/CController.php(300): CInlineAction->run()

#9 /home/gbk/Instalki/yii-1.1.0.r1700/framework/web/CController.php(278): CController->runAction(Object(CInlineAction))

#10 /home/gbk/Instalki/yii-1.1.0.r1700/framework/web/CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array)

#11 /home/gbk/Instalki/yii-1.1.0.r1700/framework/web/CWebApplication.php(320): CController->run(’’)

#12 /home/gbk/Instalki/yii-1.1.0.r1700/framework/web/CWebApplication.php(120): CWebApplication->runController(’’)

#13 /home/gbk/Instalki/yii-1.1.0.r1700/framework/base/CApplication.php(135): CWebApplication->processRequest()

#14 /home/gbk/Instalki/Projekty_Symfony/ipoba/web/index.php(11): CApplication->run()

#15 {main}

[size="4"]WHY??? getIsSecureConnection is known in 1.0.5 (http/https switching by url prefix works excellent) and unknown in 1.1.0???

[b]How to solve the problem?

Thanks for any ideas in advance.[/b] Greg[/size]

getIsSecureConnection() is part of the request component:


Yii::app()->request->getIsSecureConnection();

Thanks a lot - quick and accurate shot!!! It works - well done!!!

As a newbie may I ask Advanced Member for 2-3 sentences of comment, please? What’s changed in construction/structure of Yii that my initial code is not valid any more? How could I find the solution of that problem myself? I appreciate Your so fast and efficient help.

Greg from Poland

(Who is my benefactor? :)

To my knowledge, this never did worked. So I don’t know how you got it to work with 1.05.

However, in general you should always read the UPGRADE file for introductions about how to upgrade your application. Everything you need to know is in there. :)