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?

2
  • Is this the only reference to the session you're using? Are you using something like $session->set('something', 'something'); anywhere else?
    – Lodder
    Commented Apr 26, 2016 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
    Commented Apr 26, 2016 at 10:05

1 Answer 1

2

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.

3
  • 2
    no, you 100% don't. I mean this isn't causing issues. Used this many times.
    – Alexandr
    Commented May 26, 2016 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
    Commented Jun 9, 2016 at 9:33
  • 1
    well I think it's something with your server then)
    – Alexandr
    Commented Jun 9, 2016 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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