FirePHP Firefox extension causing CodeIgniter session lost

Recently I ran into problems in all CodeIgniter projects using session library.

Symptom: session_id is being reset randomly and all session data are lost.

After an hour of tracing I finally found the “bug”:

  • FirePHP modified the User Agent string when FireBug enabled
  • CodeIgniter destroy the current session due to invalid User Agent
  • New session started, old session data lost

To fix the problem just disable $config['sess_match_useragent'] in config.php,
or disable “Modify User-Agent Header” in FirePHP option (recommended).

P.S. I used to think it’s related to an old CodeIgniter AJAX bug and $config['sess_time_to_update'], but finally found they are totally irrelevant.