Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session_start(): Setting option 'session.name' failed #2408

Closed
geckoneer opened this issue Mar 14, 2019 · 3 comments
Closed

session_start(): Setting option 'session.name' failed #2408

geckoneer opened this issue Mar 14, 2019 · 3 comments
Assignees

Comments

@geckoneer
Copy link

Trying out Grav on my Linux laptop. Ubuntu 18.04 LTS, php (7.2), nginx, php-fpm from system packages. Nginx config from webserver-configs directory with a modified server_name directive to match the website hostname configured in /etc/hosts.

When accessing http://mysitename.local/ for the first time, I get an exception with a stack trace.

session_start(): Setting option 'session.name' failed

The root cause is that $options arrays has keys with session. prefixes when invoking session_start() in system/src/Grav/Framework/Session/Session.php line 192. That is incorrect. The docs for session_start() explicitly say that $options array should not have session. prefixes.
Here is the array I get

array:11 [▼
  "session.name" => "grav-site-XXXXXX"
  "session.cookie_lifetime" => "1800"
  "session.cookie_path" => "/"
  "session.cookie_domain" => "mysitename.local"
  "session.cookie_secure" => "0"
  "session.cookie_httponly" => "1"
  "session.cache_limiter" => "nocache"
  "session.use_trans_sid" => "0"
  "session.use_cookies" => "1"
  "session.lazy_write" => "1"
  "session.use_strict_mode" => "1"
]

I would have provided a patch but I am not yet familiar with the codebase. The patch I hacked works for me, but I need to learn how to run the test suite if Grav has one...

The error should have been caught by others but for some reason I am the person reporting it... And suppressing warnings with @ seems fishy to me.

@geckoneer
Copy link
Author

I got this exception because I had xdebug.scream set to 1 that essentially disables @.
https://xdebug.org/docs/all_settings

@hamdygamal
Copy link

i think it does happen because you named each key in array with dot
try to remove that . between session and properties like this

$_SESSION = array ([
"name" => "grav-site-XXXXXX",
"cookie_lifetime" => "1800",
"cookie_path" => "/",
"cookie_domain" => "mysitename.local"
"cookie_secure" => "0",
"cookie_httponly" => "1",
"cache_limiter" => "nocache",
"use_trans_sid" => "0",
"use_cookies" => "1",
"lazy_write" => "1",
"use_strict_mode" => "1",
]);

try this its should be works

@mahagr
Copy link
Member

mahagr commented Jan 25, 2021

This has been fixed for a long time ago. It's using ini_set() now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants