[php-src] PR #24467: Fix GH-16910: Fractional seconds truncated in prepared statements
| From: | ojuschugh1 | Date: | Tue, 20 Oct 2026 19:19:45 +0000 |
| Subject: | [php-src] PR #24467: Fix GH-16910: Fractional seconds truncated in prepared statements | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-39648@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/24467
Author: ojuschugh1
Fixes #16910
The problem was that
ps_fetch_time() and ps_fetch_datetime() only print
second_part when decimals is 1 to 6, the check added for bug #76386.
MariaDB reports AUTO_SEC_PART_DIGITS (39) when the precision isn't known up front,
for example for FROM_UNIXTIME('1992.1'), so prepared statements dropped the
fraction that the text protocol returns.
I made 39 print six digits when second_part is non-zero and none otherwise, the same as
MariaDB Connector/C, which gives the same strings as the text protocol. I kept it to 39 rather than
every value above 6 because Connector/C checks for exactly that value. ps_fetch_time()
gets the same change, though on MariaDB 13.0.2 I only got 39 for FROM_UNIXTIME()
(TIMESTAMP) results.
The test compares the text and binary protocol results and skips unless the server reports 39 for
FROM_UNIXTIME(). It fails without the fix on MariaDB 13.0.2 and skips on MySQL 8.4.13,
and the other ext/mysqli, ext/pdo_mysql and ext/mysqlnd tests give the same results with and without
the fix on both servers.