J3.x

Session Fatal Error in some CLI Scripts

From Joomla! Documentation

Revision as of 13:32, 9 April 2016 by MATsxm (talk | contribs) (version fix)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Other languages:
English • ‎Nederlands • ‎español • ‎français
Joomla! 
3.5.1

Some CLI scripts started failing in Joomla 3.5.0 and higher

Errors reported[edit]

Fatal error: Call to a member function get() on null in /libraries/joomla/session/handler/joomla.php on line 70

Versions affected[edit]

General Information

This pertains only to Joomla! version(s): 3.5.0 and higher

What is the cause[edit]

A mass refactoring of the session library in Joomla 3.5.0 for future stability broke some old CLI scripts

How to fix[edit]

Ensure that you call the session initialise method with:

$session->initialise()

ensuring that the first parameter is a JInput object (which should be retrievable from the application or you can create a new one). For more information please read the method documentation at https://github.com/joomla/joomla-cms/blob/3.5.0/libraries/joomla/session/session.php#L464