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_FormBuilder » Bug #624

FormBuilder bug caused by DataObject improvements

Details

Submitted2004-01-26 00:36 UTC
Frompear-dev at mocsnik dot hu
Assignedmw21st
StatusClosed
PackageDB_DataObject_FormBuilder
PHP VersionIrrelevant
OSirrelevant
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):
...