PHP warning

Cannot modify header information - headers already sent by (output started at /home/www/clients/client2023/web4504/web/protected/controllers/NewsController.php:50)

/home/www/clients/client2023/web4504/framework/web/CHttpRequest.php(1380)

1368     }
1369 
1370     /**
1371      * Sends a cookie.
1372      * @param CHttpCookie $cookie cookie to be sent
1373      */
1374     protected function addCookie($cookie)
1375     {
1376         $value=$cookie->value;
1377         if($this->_request->enableCookieValidation)
1378             $value=Yii::app()->getSecurityManager()->hashData(serialize($value));
1379         if(version_compare(PHP_VERSION,'5.2.0','>='))
1380             setcookie($cookie->name,$value,$cookie->expire,$cookie->path,$cookie->domain,$cookie->secure,$cookie->httpOnly);
1381         else
1382             setcookie($cookie->name,$value,$cookie->expire,$cookie->path,$cookie->domain,$cookie->secure);
1383     }
1384 
1385     /**
1386      * Deletes a cookie.
1387      * @param CHttpCookie $cookie cookie to be deleted
1388      */
1389     protected function removeCookie($cookie)
1390     {
1391         if(version_compare(PHP_VERSION,'5.2.0','>='))
1392             setcookie($cookie->name,'',0,$cookie->path,$cookie->domain,$cookie->secure,$cookie->httpOnly);

Stack Trace

#3
+
 /home/www/clients/client2023/web4504/web/protected/components/Functions.php(19): CMap->offsetSet("customer_id", CHttpCookie)
14 
15     public static function setCookie($cookie_name, $cookie_value, $time = 30) {
16 
17         $cookie = new CHttpCookie($cookie_name, $cookie_value);
18         $cookie->expire = time() + 60 * 60 * 24 * $time;
19         Yii::app()->request->cookies[$cookie_name] = $cookie;
20         return true;
21     }
22 
23     public static function setCookieforCustomer() {
24         if(!isset(Yii::app()->request->cookies['customer_id'])){
#4
+
 /home/www/clients/client2023/web4504/web/protected/components/Functions.php(26): Functions::setCookie("customer_id", "Pmab16cBkp")
21     }
22 
23     public static function setCookieforCustomer() {
24         if(!isset(Yii::app()->request->cookies['customer_id'])){
25             $customer_id = self::generateRandomString();
26             self::setCookie('customer_id', $customer_id);
27         }
28     }
29     
30     public static function getCustomerId(){
31         
#5
+
 /home/www/clients/client2023/web4504/web/protected/views/layouts/main.php(3): Functions::setCookieforCustomer()
1 <?php
2 /* @var $this Controller */
3 Functions::setCookieforCustomer();
4 $menu_list = Content::model()->with('contentDataByLangs')->findAllByAttributes(array(), array(
5     'condition' => "t.active = 1 AND position = 0 AND t.id != 20",
6         ));
7 $down_menu_list = Content::model()->with('contentDataByLangs')->findAllByAttributes(array(), array(
8     'condition' => "t.active = 1 AND position = 1 AND t.id != 20",
2018-10-22 01:29:25 Apache/2.2.22 (Debian) Yii Framework/1.1.14