mbe.ro
<h2>What is this web-site?</h2> <br/> <start_coding(); //just some tips and tricks for web programmers<br/>echo "Hope this is helpful to you";<br/>?>

CakePHP 1.2.4.8284 Session Component Bug

August 20, 2009 at 6:08 PM

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 said
August 30, 2009 at 12:39 AM
 

Thanks. I’ve been searching for that…

Add a comment

Name:
 
Email:
 
Website:
 
Comment: