1

I am trying to get the JSession inside my module php file.

But every time I wrote this code:

$session = JFactory::getSession();

Joomla responds with a 500 error for the page that my module is loaded.

If I comment out that line, the page is loading again fine.

What am I doing wrong?

  • Is this the only reference to the session you're using? Are you using something like $session->set('something', 'something'); anywhere else? – Lodder Apr 26 '16 at 9:50
  • No I don't use other reference, but I think I figured out what the problem is. I have later in my code a print_r($session) which seems to create the issue. I guess I must use something like print_r($session->getData()). – tafvita Apr 26 '16 at 10:05
1

I think I found out my mistake that causes the error.

I have later in my code a:

print_r($session);

and this is actually the code that is generating the 500 error.

I must use something like:

print_r($session->getData());

to print out the session data.

  • 1
    no, you 100% don't. I mean this isn't causing issues. Used this many times. – Alexandr May 26 '16 at 15:47
  • @Alexandr: In my case, everytime I tried to use that in that site and on another test site, I got a 500error. Removing the print_r($session) site works. – tafvita Jun 9 '16 at 9:33
  • 1
    well I think it's something with your server then) – Alexandr Jun 9 '16 at 9:48

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.