J3.x

J3.x:Session Fatal Error in some CLI Scripts

From Joomla! Documentation

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

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

Versions affected

General Information

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

What is the cause

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

How to fix

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