Skip to content

Fix return type of SessionHandler::read() - #6884

Closed
kocsismate wants to merge 1 commit into
php:PHP-8.0from
kocsismate:session-read-stub
Closed

kocsismate wants to merge 1 commit into
php:PHP-8.0from
kocsismate:session-read-stub

Conversation

@kocsismate

Copy link
Copy Markdown
Member

No description provided.

@nikic

nikic commented Apr 20, 2021

Copy link
Copy Markdown
Member

https://www.php.net/manual/en/sessionhandlerinterface.read.php only talks about string return. The implementation seems to treat any non-string return as failure.

I think this change is fine, but how did you run across it?

@kocsismate

Copy link
Copy Markdown
Member Author

I think this change is fine, but how did you run across it?

When I was working on #6548, I added a lot of return type declarations to child methods of internal classes so that the deprecation notice is avoided. And then I noticed that a session test is failing (I believe it was ext/session/tests/session_set_save_handler_class_005.phpt) because the false return value of the parent::read($id) got converted to "".

@nikic nikic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks.

@kocsismate

Copy link
Copy Markdown
Member Author

Closing via ffb1ff3

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants