Fixed PHP 7 Catchable fatal error: session_regenerate_id(): Failed to create(read) session ID: user (path: ) #12206
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
read
If read returns anything else than a string it will fail with PHP Catchable fatal error: session_regenerate_id(): Failed to create(read) session ID: user. PHP 7 requires that reading always returns a string, regardless the existence of data.
destroy
When session_regenerate_id() is called right after session_start() php tries to destroy a session that doesn't exist yet. destroy() to wrongly return false when the session doesn't exist yet. PHP 7 will then fail with Warning: session_regenerate_id(): Session object destruction failed. ID: user (path: ) .