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

Fix #67122: PDO::ATTR_EMULATE_PREPARES = false drops microseconds from timestamp #3245

Closed
wants to merge 1 commit into from
Closed

Fix #67122: PDO::ATTR_EMULATE_PREPARES = false drops microseconds from timestamp #3245

wants to merge 1 commit into from

Conversation

antonkomarev
Copy link

Fix #67122

When the PDO attribute ATTR_EMULATE_PREPARES is false, any microseconds are dropped from timestamp columns on MySQL >= 5.6.4 & MariaDB >= 5.3.

This bug was filed for PHP 5.5, but I've made PR for lowest yet supported PHP 5.6.

I haven't added any new tests, if they are required I need a bit more time to understand how to write them and append to this PR.

…m timestamp

When the PDO attribute ATTR_EMULATE_PREPARES is false, any microseconds are dropped from timestamp columns on MySQL >= 5.6.4 & MariaDB >= 5.3.
@antonkomarev
Copy link
Author

Sadly, it seems to break mysqli. Any advices how to fix it are welcome!

@weltling
Copy link
Contributor

Thanks for the PR. A test is required, to see what is being fixed and to ensure it won't be broken in the future. Also only targeting 7.1+ makes sense, this kind of patch can't be applied to lower branches.

With the failing mysqli test - you need to debug it through.

Thanks.

@antonkomarev
Copy link
Author

@weltling thanks for your feedback, I will retarget it to PHP 7.1 and see if mysqli will fail too, then I should learn how to add new tests.

@antonkomarev antonkomarev changed the base branch from PHP-5.6 to PHP-7.1 May 21, 2018 19:21
@KalleZ
Copy link
Member

KalleZ commented May 21, 2018

@a-komarev For tests, you can find all the information about writing new test cases here at the QA website: http://qa.php.net/write-test.php

Thanks for your work!

@jiangding
Copy link

it's failed

@antonkomarev
Copy link
Author

@jiangding what failed? Have you tried to compile it and tested PDO query, or you just saying that TravisCI tests are failed?

@strongholdmedia
Copy link
Contributor

strongholdmedia commented May 30, 2018

Sorry but this "fix" is unacceptable as it only works for DATETIME(6) or TIMESTAMP(6) whilst MySQL supports arbitrary precision.

See #3257 for a more appropriate solution that is backwards compatible and supports all possible precisions.

@antonkomarev
Copy link
Author

Closing, since more appropriate solution was provided by @strongholdmedia.

@antonkomarev antonkomarev deleted the fix/pdo-time-fractions-bug branch May 30, 2018 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants