-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpFoundation] Fix PdoSessionHandler to work properly with streams #12146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -498,6 +498,8 @@ private function rollback() | |||
* @param string $sessionId Session ID | |||
* | |||
* @return string The session data | |||
* | |||
* @throws \PDOException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
every method can throw this. so this is not really helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it because PhpStorm shows a warning otherwise: "PHPDoc comment doesn't contain all necessary @throws tag(s)". Should I remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes because this doesnt only apply to this method.
Did you test this class with a real sqlite connection? If so could you please also test the blocking with https://github.com/Tobion/symfony-standard/tree/session-locking-test ? |
I didn't test it with a real sqlite connection as I don't use custom session handlers in my project. I've installed your |
if ($sessionRows) { | ||
return is_resource($sessionRows[0][0]) | ||
? stream_get_contents($sessionRows[0][0]) | ||
: $sessionRows[0][0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move everything on one line? Same below, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Did you update https://github.com/Tobion/symfony-standard/blob/session-locking-test/app/config/config.yml#L46 to use postgres? You can test blocking by loading two pages |
class MockPdo extends \PDO | ||
{ | ||
public $driverName; | ||
public $errorMode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errorMode and driverName can be private
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@Tobion I've tested |
Cool thanks. And did pdo_pgsql indeed return a stream for the binary field? |
Yes, and it's mentioned in the manual:
|
👍 Thanks for fixing this and doing functional tests. |
Thank you @rybakit. |
Ref: #10931 (comment)