Skip to content

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.

5 participants