Skip to main content
Topic: PHP Notice: Undefined variable: _SESSION in  (Read 13606 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

PHP Notice: Undefined variable: _SESSION in

When I open a thread ore category than I become this error.

What can I do?
Code: [Select]
28-Mar-2016 10:38:09 Etc/GMT0] PHP Notice:  Undefined variable: _SESSION in /home/u605434157/public_html/forum/sources/subs/HttpReq.class.php on line 95
[28-Mar-2016 10:38:09 Etc/GMT0] PHP Fatal error:  Uncaught exception 'InvalidArgumentException' with message 'Passed variable is not an array or object, using empty array instead' in /home/u605434157/public_html/forum/sources/subs/HttpReq.class.php:95
Stack trace:
#0 /home/u605434157/public_html/forum/sources/subs/HttpReq.class.php(95): ArrayObject->__construct(NULL, 2)
#1 /home/u605434157/public_html/forum/sources/subs/HttpReq.class.php(360): HttpReq->__construct()
#2 /home/u605434157/public_html/forum/sources/Action.controller.php(53): HttpReq::instance()
#3 /home/u605434157/public_html/forum/index.php(155): Action_Controller->__construct()
#4 {main}
  thrown in /home/u605434157/public_html/forum/sources/subs/HttpReq.class.php on line 95

Re: PHP Notice: Undefined variable: _SESSION in

Reply #1

That file only exists on the 1.1 development branch.

I think this would imply that sources/Session.php wasn't loaded or something, because without session_start() there's no $_SESSION. Are you sure you have the very latest files and all that?

Re: PHP Notice: Undefined variable: _SESSION in

Reply #2

It's the scheduled tasks controller: it's initialized and run before the session is loaded and when the Action_Controller tries to use $_SESSION, it doesn't exit.
At the moment I'm not sure what the best action is. I would avoid load the session just for scheduled tasks, but seems the less messed-up for the code.
Bugs creator.
Features destroyer.
Template killer.

Re: PHP Notice: Undefined variable: _SESSION in

Reply #3

Ok thanks for reply how to fix that.

German

OK danke für die Antwort wie kann ich das Problem lösen.

Re: PHP Notice: Undefined variable: _SESSION in

Reply #4

I made a quick and dirty adjustment that only copied that array in httpreq if and only if session was actually started. This stopped the error cleanly but I was never sure if that was appropriate so I didn't embed it in my pull requests.

Re: PHP Notice: Undefined variable: _SESSION in

Reply #5

Yep, I was thinking about something similar.
It should be fine, because as far as I can see the only time it is used that way is in scheduled tasks and that don't seem to use session in any way.
It may be worth think of some other ways, but not too pressing.

@wumix is there any particular reason you use 1.1 instead of the current stable version 1.0?
Bugs creator.
Features destroyer.
Template killer.

Re: PHP Notice: Undefined variable: _SESSION in

Reply #6

Okay  what is the stable download of elkarte?

1.0.6 ore 1.0.7

Re: PHP Notice: Undefined variable: _SESSION in

Reply #7

Oh sorry also the stable version is 1.0?
First I downloaded development version that's my failure.
I have yet download the version from the portal 1.0.6

And tray again with a fresh install.

Re: PHP Notice: Undefined variable: _SESSION in

Reply #8

I have found the problem!

When I mark the checkbox for

Search engine friendly URLs
Apache/Lighttpd only
This feature will work on your server.

Than come this failure.

My server can this option. Only the script will not work when I check this option.

 

Re: PHP Notice: Undefined variable: _SESSION in

Reply #9

The current stable is 1.0.7, released early today:
https://github.com/elkarte/Elkarte/releases/tag/v1.0.7
http://www.elkarte.net/community/index.php?topic=3439.0
You can download the "ElkArte_v1-0-7_install.zip" file and use it. ;)
Bugs creator.
Features destroyer.
Template killer.

Re: PHP Notice: Undefined variable: _SESSION in

Reply #10

Quote from: emanuele – Yep, I was thinking about something similar.
It should be fine, because as far as I can see the only time it is used that way is in scheduled tasks and that don't seem to use session in any way.
It may be worth think of some other ways, but not too pressing.

@wumix is there any particular reason you use 1.1 instead of the current stable version 1.0?

Yeah it'll be in my next pr. Lots of stuff simply does not work without fixing it.

Re: PHP Notice: Undefined variable: _SESSION in

Reply #11

Indeed! xD
Bugs creator.
Features destroyer.
Template killer.

Re: PHP Notice: Undefined variable: _SESSION in

Reply #12

And pr is in.

Re: PHP Notice: Undefined variable: _SESSION in

Reply #13

And it starts again with me not receiving github notifications... >_>
Bugs creator.
Features destroyer.
Template killer.