-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
After php8.1, when PDO::ATTR_EMULATE_PREPARES is true and PDO::ATTR_STRINGIFY_FETCHES is true, decimal zeros are no longer filled. #11587
Comments
I think need more detailed explanation.
At least, MySQL 8.0.33 (Server version: 8.0.33-0ubuntu0.20.04.2 (Ubuntu)) and PHP 8.0 using PDO, displays
I using below code, I can't reproduced on 8.0 and 8.1
Result is same.
|
I certainly didn't have enough information.
Also, I described it as a float type, but it was actually a float(3,2) type, sorry. I have created a table with the following structure.
I then inserted the following record.
With that in place, I tested the following code.
The results are as follows.
The decimal type shows no difference. I know that these types will not be supported in the future. But in any case, I reported it because there are cases where the "behavior of previous versions" cannot be reproduced as described in the documentation. I could not determine if it was a bug in the first place, but I could not find the proper place to post the issue, so I posted it here. |
@SakiTakamachi Thanks for further information! I don't know well Does anyone know? |
Thank you for confirming! It seems that Running the same test with
Presumably due to the change in behavior when |
@SakiTakamachi
This seems behavior change is intentional to PHP 8.1. |
I have already read this document. As described in this issue, The issue is that there is a statement in the documentation that says:
It may not be restored in practice, so either the implementation or the documentation should be modified to eliminate the discrepancy. |
@SakiTakamachi Thanks, I understand. I found this behavior changes commit caa7100, but convert double to string is not changed. |
I think floating point |
Oops, I misunderstanding. I'm sorry. Reproduce in |
* PHP-8.1: Fix GH-11587 PDO::ATTR_STRINGIFY_FETCHES should return strings even in if PDO::ATTR_EMULATE_PREPARES is enabled
* PHP-8.2: Fix GH-11587 PDO::ATTR_STRINGIFY_FETCHES should return strings even in if PDO::ATTR_EMULATE_PREPARES is enabled
Noting that upgrading php from 8.1.21 to 8.1.22 is resulting in the following exception being thrown on Drupal sites using the sqlsrv module:
This exception is being thrown by |
@LichP If you said correct, maybe is this https://github.com/php/php-src/pull/11622/files#diff-9a6d6a4359a98668fef29400492f877938424d1b1d2e84933c91ab34161cf360R795-R797 ? This issue/PR is about @SakiTakamachi Any thoughts? |
This is certainly an effect of my modification. First reported here. PDO SQLSRV is an ext outside the php-src and I have a fix PR now, but no progress.... |
@LichP Thank you very much for report. @SakiTakamachi trying microsoft/msphpsql#1468 , but seems don't good response, Therefore, could you think about implementation workaround? |
Thanks everyone for looking into this - hopefully @SakiTakamachi 's msphpsql PR will be committed soon. To work around this I've wrapped the setAttribute call in the Drupal sqlsrv module in a try / catch. As I understand it the exception is only triggered by the call into the driver's set attribute implementation after the database handle's stringify attribute has been updated, so the setAttribute call effectively succeeds even though an exception is thrown. |
This is a very interesting error avoidance method. I will try it later too. Thank you! |
Description
document
MySQL Driver ¶
I do not know if this is the intended change, but I believe that either the implementation or the documentation must be corrected, since at least the documentation is different from the actual situation.
What do you think?
I posted the same information in the document issue.
php/doc-en#2557
PHP Version
PHP 8.2.7
Operating System
No response
The text was updated successfully, but these errors were encountered: