zendframework / zend-expressive-session-ext

PHP ext-session persistence adapter for zend-expressive-session.
BSD 3-Clause "New" or "Revised" License
12 stars 9 forks source link

Options in startSession() causing ErrorException #32

Open Musiksammler opened 5 years ago

Musiksammler commented 5 years ago

Hello!

I upgraded zendframework/zend-expressive-session-ext in my project from version 1.3.0 to 1.4.0.

I don't know why, but with this version I got an error exception when startSession is called:

private function startSession(string $id, array $options = []) : void
{
    session_id($id);
    session_start(array_merge([
        'use_cookies'      => false,
        'use_only_cookies' => true,
        'cache_limiter'    => '',
    ], $options));
}

ErrorException: session_start(): Setting option 'use_cookies' failed.

So I removed the "use_cookies => false" line but the same error message with "use_only_cookies" was thrown. Only after I removed that line too it worked. I changed nothing else in my code, only updated the composer package.

Here are my php.ini settings:

igbinary session support => yes session.auto_start => Off => Off session.cache_expire => 180 => 180 session.cache_limiter => nocache => nocache session.cookie_domain => no value => no value session.cookie_lifetime => 0 => 0 session.cookie_path => / => / session.cookie_secure => 0 => 0 session.gc_divisor => 1000 => 1000 session.gc_probability => 1 => 1 session.lazy_write => On => On session.name => PHPSESSID => PHPSESSID session.referer_check => no value => no value session.serialize_handler => php => php session.sid_bits_per_character => 5 => 5 session.sid_length => 26 => 26 session.upload_progress.cleanup => On => On session.upload_progress.enabled => On => On session.upload_progress.freq => 1% => 1% session.upload_progress.min_freq => 1 => 1 session.upload_progress.name => PHP_SESSION_UPLOAD_PROGRESS => PHP_SESSION_UPLOAD_PROGRESS session.upload_progress.prefix => uploadprogress => uploadprogress session.use_strict_mode => 0 => 0 session.use_trans_sid => 0 => 0 session.trans_sid_hosts => no value => no value session.trans_sid_tags => [a lot of tags...]

And these settings are set in the website-configuration.

session.gc_maxlifetime = 3600 session.save_handler = redis session.save_path = "tcp://172.30.0.65:6379?weight=1" session.cookie_httponly = 1 session.use_cookies = 1 session.use_only_cookies = 1

pine3ree commented 5 years ago

Hello @Musiksammler, I checked the php-src and I believe it's a permission error. It seems you cannot modified those settings anymore (by default they can be modified in PHP_INI_ALL contexts). The startSession() method code is unchanged from v 1.3.0 to v. 1.4.0. kind regards.

weierophinney commented 4 years ago

This repository has been closed and moved to mezzio/mezzio-session-ext; a new issue has been opened at https://github.com/mezzio/mezzio-session-ext/issues/3.