Fix #67122: PDO::ATTR_EMULATE_PREPARES = false drops microseconds from timestamp#3245
Fix #67122: PDO::ATTR_EMULATE_PREPARES = false drops microseconds from timestamp#3245antonkomarev wants to merge 1 commit intophp:PHP-7.1from antonkomarev:fix/pdo-time-fractions-bug
Conversation
…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.
|
Sadly, it seems to break |
|
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. |
|
@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. |
|
@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! |
|
it's failed |
|
@jiangding what failed? Have you tried to compile it and tested PDO query, or you just saying that TravisCI tests are failed? |
|
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. |
|
Closing, since more appropriate solution was provided by @strongholdmedia. |
Fix #67122
When the PDO attribute
ATTR_EMULATE_PREPARESisfalse, 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.