Skip to content
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

PDOSessionHandler stream usage in 2.6 introduces PHP Bug #40913 #12834

Closed
brianfreytag opened this issue Dec 3, 2014 · 5 comments
Closed

PDOSessionHandler stream usage in 2.6 introduces PHP Bug #40913 #12834

brianfreytag opened this issue Dec 3, 2014 · 5 comments

Comments

@brianfreytag
Copy link
Contributor

There is a PHP bug that was submitted in 2007 that still applies today.

https://bugs.php.net/bug.php?id=40913

In commit 1bc6680, the Session data column was updated to a PDO::PARAM_LOB from a base64 encoded PDO::PARAM_STR.

This now introduces the PHP Bug 40913 linked above. Instead of returning a Resource, it returns a string. This makes it impossible to load the sessions correctly.

Since it is returning $session[0][0] as a string instead of a resource, is_resource($session[0][0]) returns false, and then it returns a string, and then PHP doesn't know what to do with it, so authentication breaks.

@brianfreytag
Copy link
Contributor Author

I'd also like to note that this issue also breaks backwards compatibility along with #12833

@Tobion
Copy link
Member

Tobion commented Dec 4, 2014

@brianfreytag what pdo driver are you using? And why does the string returned not work? Is it malformed? Because a string with the session data is exactly what we want at the end.

@brianfreytag
Copy link
Contributor Author

We are using ODBC.

The problem is the the session data is being stored as an VARBINARY. It's returning that VARBINARY as a string. When PHP tries to match it up in the database, it's using a string and trying to match it up with a VARBINARY. That won't work. It's trying to use a string like stream data.

Please read through the PHP bug report. It's pretty widely known and they go into much greater detail.

Regardless, we reverted back to 2.5.8 until all of these BC breaking files have been reverted.

@Tobion
Copy link
Member

Tobion commented Mar 17, 2015

@brianfreytag I think you mixed two different things here. The data is saved in a BLOB.
I guess you are talking about the ID which might be saved in a VARBINARY. See https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php#L221

That the data is a string instead of a resource should not be a problem. But the problem is probably that ODBC behaves different from pdo_mysql that I tested it with when dealing with VARBINARY.
Can you please test if changing the ID column to VARCHAR(128) solves the problem?

@fabpot
Copy link
Member

fabpot commented Oct 5, 2015

Closing as there is no feedback from the reporter.

@fabpot fabpot closed this as completed Oct 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants