-
Notifications
You must be signed in to change notification settings - Fork 373
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
Error "String data, right truncation" when reusing the same prepared statemnt many times under PHP 8.1 with pdo_sqlsrv 5.10 beta1 #1329
Comments
Thanks @acelaya for the repro. We will investigate and get back to you on this. |
Hi @acelaya I was able to reproduce this issue with PHP 8.0 and pdo_sqlsrv 5.10.0beta1, but it seems that the recent pull request #1311 has fixed this issue. I ran your script and successfully inserted the records, as shown below: We are planning to release 5.10.0beta2 with this fix in early December. If you want to test it out earlier, you can apply the patch from the aforementioned pull request. Hope this helps, and thanks again for the repro scenario! |
Thanks! I can wait for beta2, and will test it then. |
Sure! Will update you with the release |
5.10.0-beta 2 is just released. Please give it a try @acelaya |
Thanks for the heads up! |
Works! |
Closing this now please feel free to ask us to reopen. |
PHP Driver version or file name
5.10.0beta1
SQL Server version
I'm using docker image
mcr.microsoft.com/mssql/server:2019-latest
.Client operating system
Alpine.
PHP version
8.1 RC6
Microsoft ODBC Driver version
17.5.2.2
Table schema
Included in repo with reproducible sandbox: ddl.sql
Problem description
It took me some time to reproduce this on a small env, and I'm still not completely sure if the error is on the driver itself, or on how the DBAL library I use (doctrine) is handling prepared statements internally, but this is reproducible only with PHP 8.1 and pdo_sqlsrv 5.10. With PHP 8.0 and pdo_sqlsrv 5.9 everything works as expected.
Expected behavior and actual behavior
Expected behavior: Reusing the same prepared statement with new bind params, allows for the same query to be run again.
Actual behavior: The second time the same prepared statement is used, the error
[Microsoft][ODBC Driver 17 for SQL Server]String data, right truncation
is thrown.Repro code or steps to reproduce
I have prepared a small repository with everything needed to reproduce the steps. The README file explains how to start 3 docker containers, one with MS SQL server, one with PHP 8.0, and one with PHP 8.1, and then how to create the database, and run a simple PHP script in both PHP containers.
But in short, this is the script:
The text was updated successfully, but these errors were encountered: