Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.6

Bug #5060 empty date fields cause data to be invalid
Submitted: 2005-08-10 23:39 UTC
From: jameslee at cs dot nmt dot edu Assigned: wiesemann
Status: No Feedback Package: DB_Table
PHP Version: 4.3.11 OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 29 - 25 = ?

 
 [2005-08-10 23:39 UTC] jameslee at cs dot nmt dot edu
Description: ------------ Empty day and month dropdowns from a date field cause an error. Suggested patch: Table.php, line 1586 from: $m = (strlen($val['m']) < 2) ? '0'.$val['m'] : $val['m']; $d = (strlen($val['d']) < 2) ? '0'.$val['d'] : $val['d']; to: $m = (strlen($val['m']) < 2) ? str_pad($val['m'],2,'0',STR_PAD_LEFT) : $val['m']; $d = (strlen($val['d']) < 2) ? str_pad($val['d'],2,'0',STR_PAD_LEFT) : $val['d']; Test script: --------------- ... $col = array( 'Birthdate' = array( 'type' => 'date', 'qf_opts' => array( 'addEmptyOption' => TRUE, 'minYear' => 1920, ), ), ); ... $tableObj->insert($values); Expected result: ---------------- NULL or 0000-00-00 to be inserted; 0s seem easier Actual result: -------------- error: Insert data not valid for column 'Birthdate' ('0000-0-0')

Comments

 [2005-08-10 23:45 UTC] jameslee at cs dot nmt dot edu
edit: It seems that my assumptions about how dates are handled were wrong and the suggested patch actually does nothing. Therefore, I am unable to suggest a solution.
 [2005-08-16 17:37 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2005-08-24 20:22 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2005-09-10 14:40 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2009-04-01 13:47 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!