Home » Database » DB_DataObject_FormBuilder » Bug #624
FormBuilder bug caused by DataObject improvements
Details
| Submitted | 2004-01-26 00:36 UTC |
|---|---|
| From | pear-dev at mocsnik dot hu |
| Assigned | mw21st |
| Status | Closed |
| Package | DB_DataObject_FormBuilder |
| PHP Version | Irrelevant |
| OS | irrelevant |
| Roadmaps | (Not assigned) |
Comments
[2004-01-26 00: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.
[2004-02-28 03: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-03 01: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):
...