ElkArte Community

Elk Development => Bug Reports => Exterminated Bugs => Topic started by: wumix on March 28, 2016, 08:09:30 am

Title: PHP Notice: Undefined variable: _SESSION in
Post by: wumix on March 28, 2016, 08:09:30 am
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
Title: Re: PHP Notice: Undefined variable: _SESSION in
Post by: Frenzie on March 28, 2016, 08:47:34 am
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?
Title: Re: PHP Notice: Undefined variable: _SESSION in
Post by: emanuele on March 28, 2016, 10:12:18 am
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.
Title: Re: PHP Notice: Undefined variable: _SESSION in
Post by: wumix on March 28, 2016, 01:44:55 pm
Ok thanks for reply how to fix that.

German

OK danke für die Antwort wie kann ich das Problem lösen.
Title: Re: PHP Notice: Undefined variable: _SESSION in
Post by: Vekseid on March 28, 2016, 02:45:41 pm
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.
Title: Re: PHP Notice: Undefined variable: _SESSION in
Post by: emanuele on March 28, 2016, 02:59:28 pm
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?
Title: Re: PHP Notice: Undefined variable: _SESSION in
Post by: wumix on March 28, 2016, 03:00:56 pm
Okay  what is the stable download of elkarte?

1.0.6 ore 1.0.7
Title: Re: PHP Notice: Undefined variable: _SESSION in
Post by: wumix on March 28, 2016, 03:12:27 pm
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.
Title: Re: PHP Notice: Undefined variable: _SESSION in
Post by: wumix on March 28, 2016, 04:35:42 pm
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.
Title: Re: PHP Notice: Undefined variable: _SESSION in
Post by: emanuele on March 28, 2016, 05:33:45 pm
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. ;)
Title: Re: PHP Notice: Undefined variable: _SESSION in
Post by: Vekseid on March 29, 2016, 05:15:08 pm
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.
Title: Re: PHP Notice: Undefined variable: _SESSION in
Post by: emanuele on March 30, 2016, 04:33:19 am
Indeed! xD
Title: Re: PHP Notice: Undefined variable: _SESSION in
Post by: Vekseid on March 30, 2016, 07:08:37 pm
And pr is in.
Title: Re: PHP Notice: Undefined variable: _SESSION in
Post by: emanuele on March 31, 2016, 02:19:26 am
And it starts again with me not receiving github notifications... >_>