Bug #67122 [Com]: PDO::ATTR_EMULATE_PREPARES = false drops microseconds from timestamp

From: Date: Thu, 12 Apr 2018 10:04:50 +0000
Subject: Bug #67122 [Com]: PDO::ATTR_EMULATE_PREPARES = false drops microseconds from timestamp
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214712@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67122&edit=1

 ID:                 67122
 Comment by:         labs at strongholdmedia dot eu
 Reported by:        russellbarnhart at gmail dot com
 Summary:            PDO::ATTR_EMULATE_PREPARES = false drops
                     microseconds from timestamp
 Status:             Open
 Type:               Bug
 Package:            PDO MySQL
 Operating System:   Ubuntu 12.04 & 14.04
 PHP Version:        5.5.11
 Block user comment: N
 Private report:     N

 New Comment:

This is indeed a problem with PDO; when using mysqli, the issue is not apparent.


Previous Comments:
------------------------------------------------------------------------
[2018-04-10 12:25:58] labs at strongholdmedia dot eu

Can anybody elaborate if this is really a problem with PDO itself, or, rather, is the cause the
underlying mysqlnd (that is still 5.0.12-dev from 2015)?

------------------------------------------------------------------------
[2017-06-16 06:42:49] webmaster at etherframegames dot com

Any updates on this? I can confirm that it still exists as of 7.1.5

------------------------------------------------------------------------
[2014-04-23 22:16:02] russellbarnhart at gmail dot com

Description:
------------
This is only relevant on the newer versions of mysql/mariaDB that support microsecond precision on
timestamp columns.

minimum Mysql version: 5.6.4
minimum MariaDB version: 5.3

When the PDO attribute ATTR_EMULATE_PREPARES is false, any microseconds are dropped from timestamp
columns.

I'm using:

MariaDB v10.0.10: mysql  Ver 15.1 Distrib 10.0.10-MariaDB, for debian-linux-gnu (x86_64) using
readline 5.1

PHP 5.5.11-3+deb.sury.org~precise+1 (cli) (built: Apr 23 2014 12:23:08)
(also tested on PHP 5.5.9-1ubuntu4 (cli) (built: Apr  9 2014 17:11:57))

mysqlnd v5.0.11-dev

Test script:
---------------
https://gist.github.com/sndsgd/11234272

Expected result:
----------------
PDO::ATTR_EMULATE_PREPARES = true:
2014-04-23 08:45:36.022588
PDO::ATTR_EMULATE_PREPARES = false:
2014-04-23 08:45:36.022588

Actual result:
--------------
PDO::ATTR_EMULATE_PREPARES = true:
2014-04-23 08:45:36.022588
PDO::ATTR_EMULATE_PREPARES = false:
2014-04-23 08:45:36


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=67122&edit=1


Thread (8 messages)

« previous php.bugs (#214712) next »