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

Bug #624 FormBuilder bug caused by DataObject improvements
Submitted: 2004-01-25 19:36 UTC Modified: 2004-05-15 17:21 UTC
From: pear-dev at mocsnik dot hu Assigned: mw21st
Status: Closed Package: DB_DataObject_FormBuilder
PHP Version: Irrelevant OS: irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2004-01-25 19:36 UTC] pear-dev at mocsnik dot hu
Description: ------------ Some version of DB_DataObject introduced define('DB_DATAOBJECT_NOTNULL', 128); // not null col. besides the already existing types: define('DB_DATAOBJECT_INT', 1); // does not require '' define('DB_DATAOBJECT_STR', 2); // requires '' etc (DB_DataObject code) This results in unsure field type auto-detection in FormBuilders generateForm() method since it actually looks like: switch ($type) { case DB_DATAOBJECT_INT: (code here) [..] case DB_DATAOBJECT_TXT: (code here) [..] } Possible solution: a) switch ($type) { case DB_DATAOBJECT_INT: case DB_DATAOBJECT_INT+DB_DATAOBJECT_NOTNULL: (code here) [...] case DB_DATAOBJECT_TXT: case DB_DATAOBJECT_TXT+DB_DATAOBJECT_NOTNULL: (code here) [..] } Reproduce code: --------------- Any code using FormBuilder with NOT NULL fields (mysql specific??) Expected result: ---------------- Correct detection of field types. Actual result: -------------- Wrong type of input elements are generated because of not up-to-date field type auto-detection.

Comments

 [2004-02-11 04:10 UTC] alan_k
the correct test is switch (true) { case ($type & DB_DATAOBJECT_INT): ... case ($type & DB_DATAOBJECT_TEXT): ... They are bitwise fields..
 [2004-02-27 22:26 UTC] pear-dev at mocsnik dot hu
Please consider using switch ($type & 127) as proposed by bubik at acvyskov dot cz in bug #919 (referring to the same bug) http://pear.php.net/bugs/bug.php?id=919 Regards, Norbert Mocsnik
 [2004-03-02 20:41 UTC] pear-dev at mocsnik dot hu
By introducing DB_DATAOBJECT_MYSQLTIMESTAMP (value 256) in DB_DataObject this won't work anymore. Please use Alan's version: switch (true) { case ($type & DB_DATAOBJECT_INT): ...
 [2004-05-15 17:21 UTC] mw21st
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.