$_GET on Ubuntu Errors

Hi…

I have develop an app and run correctly on my laptop ( I’m on Mac OS X 10.5 )

But the problem arise when i have deployed on production server ( Ubuntu 10.10 )

To describe the problem , let me told about the scenario :

  1. I have an admin page to display church list data use CGridView, and i saw from firebug that CGridView has built in ‘Church_page’ for pagination feature.

  2. I want to get benefit to use that ‘Church_page’ so create one of grid view’s column like below :




array(

   'name' => 'name',

   'type' => 'raw',

   'value' => 'CHtml::link(CHtml::encode($data->name), array("view", "id"=>$data->id, "page"=>$_GET[\'Church_page\']))', 

),



My intent is I want to bring current page value on view.php


So when i back to admin.php i can get the last page !

The problem is : when i run this on my laptop there is no error happened , BUT when i run it on Ubuntu Server 10.10 , i got an error that said :

Undefined index: Church_page

I saw on error log there is :

 $this->render('admin',array(


            'model'=>$model,


            'pageSize'=>$pageSize,


            'Church_page'=>null,


        )); 

Although my source code is only :

$this->render(‘admin’,array(

            'model'=>$model,


            'pageSize'=>$pageSize,


        ));

SO , how i can fix this solution to use Church_page or there is a way to get Church_page value from $_GET[‘Church_page’] ??

Thanks a lot

God Bless You

  1. Modify the error_reporting setting in your php.ini file:

error_reporting  =  E_ALL

It will help you to avoid surprises like this when deploying apps to production servers.

  1. Always check if the index you are looking for actually exists in $_GET array.

  2. Store it in the session:




if (isset($_GET['Church_page'])) {

	Yii::app()->session['lastChurchPage'] = $_GET['Church_page'];

}






Yii::app()->request->getParam('Church_page')



Checks if the requested parameter exist. A default value for the param can be set by using the second argument to getParam.

HTH,

– David