Just upgraded to Firefox 30.0 and sessions no longer seem to work. The cookie just doesn't set.

Using $this->session->set_userdata()

Not using Firebug, although reading on the web indicated it has been a culprit with similar issues.

Dani AI

Generated

Good catch, — a corrupted cookie after a browser upgrade is a common and confusing cause. Below is a compact, practical checklist and a few preventative fixes that are useful years later when the same symptoms appear (session cookie present but userdata disappears).

Try these diagnostics in order:

  • Test in a fresh Firefox profile or a private window (or launch with add-ons disabled) to rule out extension/profile corruption.
  • Inspect the HTTP response for the Set-Cookie header and the browser Storage inspector to confirm what the server actually sends and what Firefox stores.
  • Temporarily move session storage server-side (enable DB sessions) or turn off client-side encryption while testing to see whether the problem is cookie transport or session logic.
  • Verify your app’s encryption key hasn’t changed; encrypted cookies cannot be decrypted if the key differs, which looks like “data vanished.”

Practical fixes and causes to consider:

  • Browser upgrades can leave stale/partially-written cookies — clearing cookies for the site is the simplest fix.
  • Large encrypted payloads can exceed per-cookie size limits (~4 KB) and get dropped; prefer a server-side session (DB) if you store more than small items.
  • Mismatched cookie domain/path/secure/HttpOnly flags or aggressive privacy settings/extensions can stop the cookie from being sent back.
  • If session IDs are regenerated too often or output is sent before headers, session data may be lost — check for early output.

Quick commands to assist debugging:

# inspect Set-Cookie headers
curl -i -s http://your-site.example/ | grep -i '^Set-Cookie'

# generate a random encryption key (example)
php -r 'echo bin2hex(openssl_random_pseudo_bytes(16))."\n";'

If clearing cookies fixes it (as it did here), follow up by switching to server-side sessions or adding a stable encryption key to prevent recurrence.

In case it's relevant,

$config['sess_cookie_name']     = 'dani_session';
$config['sess_expiration']      = 0;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie']  = TRUE;
$config['sess_use_database']    = FALSE;
$config['sess_table_name']      = 'ci_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent'] = FALSE;
$config['sess_time_to_update']  = 300;

Firefox is accurately saving in a cookie the default session information (IP address, useragent, etc.) It simply won't add additional information to the session via set_userdata(). Not sure why :(

OK, I take all this back :) I got it to work somewhere else so I think something funky is going on.

OK, I take back my funkiness. Firefox sets the userdata, and then it gets destroyed right after somehow?? Works fine in older versions of FF, all versions of Chrome and Internet Explorer.

I got this fixed and it wasn't even a bug in the first place. Apparently upgrading Firefox corrupted DaniWeb's cookies. The cookies needed to be cleared to something fresh to work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.