Development

#1344 (MySQLResultSet.php getTimeStamp return strange TimeStamp)

You must first sign up to be able to contribute.

Ticket #1344 (closed defect: invalid)

Opened 2 years ago

Last modified 2 years ago

MySQLResultSet.php getTimeStamp return strange TimeStamp

Reported by: YoBoY Assigned to:
Priority: minor Milestone: 1.0.0
Component: Version: 1.0.0-beta2
Keywords: Cc:
Qualification:

Description

Hi, When a date in a field of a MySQL database is set to "0000-00-00 00:00:00" (it's the default value of a timestamp field) the function ->getTimestamp() from the driver in the MySQLResultSet.php file return a false timestamp.

The problem is

124 	        if ($this->fields[$column] === null) { return null; }
125 	        
126 	        $ts = strtotime($this->fields[$column]);

the php function strtotime('0000-00-00 00:00:00') return this timestamp : 943916400.

So to correct this i have added one line.

        if ($this->fields[$column] === null) { return null; }
        if ($this->fields[$column] === "0000-00-00 00:00:00") { return null; }
        
        $ts = strtotime($this->fields[$column]);

I don't know if it's a local config problem, or if it's a temporary MySQL issue, or if it's a symfony issue, and i don't know if it's only on MySQL. So close this ticket if it's only on my config ;)

Change History

01/22/07 08:39:52 changed by l2k

  • status changed from new to closed.
  • resolution set to invalid.

Not a symfony problem. Please report it to the Creole guys.

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.