ZF2-242: Session don't set savePath via DI configuration

Description

Zend\Session\Configuration\StandardConfiguration

Functions setSavePath and setEntropyFile has same name parameter "$path".

If you try to configure Session via DI like this 'Zend\Session\Configuration\SessionConfiguration' => array( 'parameters' => array( 'savePath' => DIR . '/../../session', 'rememberMeSeconds' => 2436001, 'cookieLifetime' => 2436001, ) ), session.save_path won't set. If change 'savePath' => 'path' DI will call function setEntropyFile.

Solution is rename $path param to $savePath in 'setSavePath' function:

public function setSavePath($savePath) { if (!is_dir($savePath)) { throw new Exception\InvalidArgumentException('Invalid save_path provided'); } $this->savePath = $savePath; $this->setStorageOption('save_path', $savePath); return $this; }

Comments

You changed function getStorageOption parameter, but you forgot change $name variable to $storageOption variable in function body (file SessionConfiguration).

Have to change:


public function getStorageOption($storageOption)
    {
        $key       = false;
        $transform = false;
        switch ($storageOption) {
            case 'remember_me_seconds':
                // No remote storage option; just return the current value
                return $this->rememberMeSeconds;
            case 'url_rewriter_tags':
                $key = 'url_rewriter.tags';
                break;
            // The following all need a transformation on the retrieved value;
            // however they use the same key naming scheme
            case 'use_cookies':
            case 'use_only_cookies':
            case 'use_trans_sid':
                $transform = function ($value) {
                    return (bool) $value;
                };
            default:
                $key = 'session.' . $storageOption;
                break;
        }

        $value = ini_get($key);
        if (false !== $transform) {
            $value = $transform($value);
        }
        return $value;
    }

Updated pull request

Change has been pushed to master: http://git.io/IoErGQ