I am updating Joomla component to Joomla 3x but getting error on code.

Code Line:

$postData = $this->dr_parameters->app->session->get('errorPostData', array() );


0 Call to a member function get() on null


I replaced the

previous code:



This code:


is this correct?

  • 1
    It depends on what $this->dr_parameters->app->session is. If $this->dr_parameters->app->session is returning a JRequest object then you need to get whatever populates $this->dr_parameters->app->session to populate it with the new object from JFactory::getApplication()->input. Or just change that line to $postData = JFactory::getApplication()->input->get('errorPostData', array());. Did that not work? – Drew G Sep 8 '17 at 19:20

Try using the JSession class to get the session data. Change this line:

$postData = $this->dr_parameters->app->session->get('errorPostData', array() );


$objSession = JFactory::getSession();
$postData = $objSession->get('errorPostData', array());

To set a session the value of a session variable, you can do this:

$objSession = JFactory::getSession();
$objSession ->set($key, $value);
| improve this answer | |
  • how can set set session, in previous code i am using this code $this->dr_parameters->app->session->set($key, $new_state); @itoctopus – Raa Hul Sep 11 '17 at 9:02
  • I have updated the answer to include setting a session variable. – itoctopus Sep 11 '17 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.