JFACTORY-GETSESSION-001

JFactory::getSession()

Factory::getSession()

Session is an application service, not a Factory shortcut.

JFactory::getSession()$app->getSession()

Dies at Joomla 5 → 6J3: Works nativelyJ4: Deprecated — do not shipJ6: Deprecated — do not shipBC plugin: not applicablePatch possible — review itJoomla API

What you will see

  • Factory::getSession is deprecated

Symptoms people search

session lost after upgrade · clear() wiped whole session

Replace this code

Swap JFactory::getSession() for $app->getSession().

Joomla 3

Remove or stop calling this

$session = JFactory::getSession();
$session->set('foo', 1);

Joomla 4 / 6

Use this instead

$session = Factory::getApplication()->getSession();

How to fix it

  1. 1Use $app->getSession().
  2. 2Replace Session::clear($key) with remove($key) — clear() now clears everything.

Also known as

getSession

Related issues

Get in touch

Have a project in mind? Let's talk about it.

Tell us what you're building. Whether it's a new site, an online store, a mobile app, or something that needs AI under the hood, we'll get back to you within a business day.

Free consultation
No commitment, no pressure
Reply within 24 hours
Usually much faster

Prefer a direct conversation?

Request a project quote

Tell us about your project

Fill out the quick form and we'll reach out.