CakePHP 1.2.4.8284 Session Component Bug

I just had a rather idiot error in CakePHP: I have a page with an ajax loaded area. In the webpage the session variables were not recognized but in the ajax loaded area they were (no matter how many refreshes of the page).

I did not find the source of the problem, however I have a fix (I don’t know how to reproduce the bug, I just know it happened and so it could happen again). To whoever might need it: If you have the app_controller created, if not, create it yourself, or whatever, make sure you have the following:

1
2
3
4
5
6
7
<?php
class AppController extends Controller {
	function beforeFilter () {
		parent::beforeFilter();
		if (!isset($_SESSION)) session_start(); //cakephp dumb fix
	}
}


 
 
1 Comment:
  • Nancy
    <
    Nancy 30 August 2009 / 00:39

    Thanks. I’ve been searching for that…

     
 
Leave a comment
* Required.
* Required. Not published.
If you have one.

 

What we do

We do web programming and we do it at its best:
  • Websites based on MVC platform
  • Wordpress plugins and templates
  • Drupal modules and themes

Facebook for Business Purposes

 

Facebook has long ended in being just a social networking website and nobody could have predicted that it will be used as a powerful marketing tool. The fact that boosted the evolution of this socializing platform into such a powerful instrument is that nowadays it is available on any device that has a basic modern [...]