PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB_DataObject » Bug #3010

fromValue() mis-handles empty date/time strings

Details

Submitted2004-12-22 13:04 UTC
Frommccarthy at ece dot ualberta dot ca
Assignedalan_k
StatusClosed
PackageDB_DataObject
PHP Version4.3.0
OSLinux
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.