Skip to content

session_regenerate_id(): Session object destruction failed. ID: user (path: ) #82

@yii-bot

Description

@yii-bot

This issue has originally been reported by @EvgenyOrekhov at yiisoft/yii2#12821.
Moved here by @samdark.


session_regenerate_id(): Session object destruction failed. ID: user (path: ) after upgrade to 2.0.10.

What steps will reproduce the problem?

  1. Add this component config:

    'session' => [
        'class' => 'yii\redis\Session',
        'redis' => [
            'hostname' => 'localhost',
        ],
        'timeout' => 10,
    ],
    
  2. Log in to the application.

  3. Wait 10 seconds.

  4. Refresh the application page.

What is the expected result?

No warning.

What do you get instead?

PHP Warning – yii\base\ErrorException

session_regenerate_id(): Session object destruction failed. ID: user (path: )

  1. in vendor/yiisoft/yii2/web/Session.php at line 282
     * Please refer to <http://php.net/session_regenerate_id> for more details.
     * @param boolean $deleteOldSession Whether to delete the old associated session file or not.
     */
    public function regenerateID($deleteOldSession = false)
    {
        if ($this->getIsActive()) {
            // add @ to inhibit possible warning due to race condition
            // https://github.com/yiisoft/yii2/pull/1812
            if (YII_DEBUG && !headers_sent()) {
                session_regenerate_id($deleteOldSession); // <-- line 282
            } else {
                @session_regenerate_id($deleteOldSession);
            }
        }
    }

Additional info

Q A
Yii version 2.0.10
PHP version 7.0.12
Operating system Alpine Linux 3.4

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions