Skip to content

Conversation

@nicolas-grekas
Copy link
Member

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #62241
License MIT

PdoSessionHandler was failing against SQL Azure when writing session data to a VARBINARY(MAX) column because the pdo_sqlsrv driver sent the data as nvarchar, which SQL Server cannot implicitly convert to varbinary(max).

This patch makes the sqlsrv driver use a stream resource for session data (like the existing oci handling), both for INSERT/UPDATE statements and the MERGE upsert path. This ensures the data is treated as binary and avoids the implicit conversion error, while keeping the existing schema (VARBINARY(MAX)) unchanged.

A new test (testSqlsrvDataBindingUsesStream) verifies that, for sqlsrv, the session data is bound as a PDO::PARAM_LOB resource when using the MERGE path.

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix symfony#62241
| License       | MIT

PdoSessionHandler was failing against SQL Azure when writing session data to a
VARBINARY(MAX) column because the pdo_sqlsrv driver sent the data as nvarchar,
which SQL Server cannot implicitly convert to varbinary(max).

This patch makes the sqlsrv driver use a stream resource for session data (like
the existing oci handling), both for INSERT/UPDATE statements and the MERGE
upsert path. This ensures the data is treated as binary and avoids the implicit
conversion error, while keeping the existing schema (VARBINARY(MAX)) unchanged.

A new test (testSqlsrvDataBindingUsesStream) verifies that, for sqlsrv, the
session data is bound as a PDO::PARAM_LOB resource when using the MERGE path.
@carsonbot carsonbot added this to the 6.4 milestone Dec 17, 2025
@carsonbot carsonbot changed the title [HttpFoundation][Cache] Fix VARBINARY columns on sqlsrv [Cache][HttpFoundation] Fix VARBINARY columns on sqlsrv Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants