|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #81644 mysql native driver should use DateTime object
Submitted: 2021-11-20 10:56 UTC Modified: 2021-11-22 13:42 UTC
From: shop1 at mokraemer dot de Assigned:
Status: Suspended Package: MySQLi related
PHP Version: 8.0.13 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: shop1 at mokraemer dot de
New email:
PHP Version: OS:


 [2021-11-20 10:56 UTC] shop1 at mokraemer dot de
if you use mysqli native driver, it fetches data and puts the data in the equivalent php datastructure. This is true for float, int, ...
But values for date,time and datetime are still strings. It would be great if this is converted automatical.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-11-20 11:47 UTC]
As PHP - at least currently - does not have native types for Date and Time there will be no possibility to convert those into Objects.

And I don't even want to tackle the topic of converting Datetime values with regards to timezones. As there is no "One size fits all" it is best to leave that up to the app.

And as the native mysqli driver only converts between native types I doubt that that is a thing that we should start.

If so, we would for sure need an RFC for that.
 [2021-11-20 21:10 UTC] shop1 at mokraemer dot de
Thanks for your comment. You're right about Date/Time we don't have anything in php for that.
For datetime and timestamp there is no problem with timezones. The conversion is done by mysql on the connection base. Anyway, now everyone who uses DateTime or timestamps from mysql in php needs to do convert that column to a DateTime object in order to do anything with the value from the database.
But maybe you're right this needs some more thinking and an RFC. Since RFC's are not easy to make for php, I guess this is the end of that idea.
 [2021-11-22 13:42 UTC]
-Status: Open +Status: Suspended
 [2021-11-22 13:42 UTC]
> Since RFC's are not easy to make for php, I guess this is the
> end of that idea.

Consider to *start* the RFC process[1] anyway (i.e. write to the
mailing list).  Maybe others are interested in this as well, but
it's unlikely those will see this ticket.

For the time being, I'm suspending this ticket.

[1] <>
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 13 10:01:33 2024 UTC