Home » Database » DB_DataObject » Bug #3010
fromValue() mis-handles empty date/time strings
Details
| Submitted | 2004-12-22 13:04 UTC |
|---|---|
| From | mccarthy at ece dot ualberta dot ca |
| Assigned | alan_k |
| Status | Closed |
| Package | DB_DataObject |
| PHP Version | 4.3.0 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2004-12-22 13:04 UTC] mccarthy at ece dot ualberta dot ca
Description:
------------
Using latest stable releases:
DB 1.6.8
DB_DataObject 1.7.2
Any code that passes an empty date or time string to fromValue() will result in invalid dates or times. In my particular case, it is via the setFrom() function where empty dates are set to 0-01-01 rather than ''.
I believe that I have identified the error within fromValue(). Essentially, every test for !$value should return after setting the column to the empty string. This occurs on lines 3226, 3241, 3259 of DataObject.php.
-- Michael McCarthy
Reproduce code:
---------------
if (!$value) {
$this->$col = '';
return true; // MRM 2004.12.22
}
Expected result:
----------------
Empty date / time strings should stay empty.