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 #4867

enumOptions renumbered for NULL fields

Details

Submitted2005-07-20 04:17 UTC
Fromevt at infoware dot com dot au
Assignedjustinpatrin
StatusClosed
PackageDB_DataObject_FormBuilder
PHP Version5.0.3
OSSuse
Roadmaps(Not assigned)

Comments

[2005-07-20 04:17 UTC] evt at infoware dot com dot au

Description:
------------
If I define my options in the enumOptions array with specific key values that I wish to store in the DB, if the DB field allows NULL then formbuilder will add the empty option and renumber my option values. This is because array_merge is used, maybe it would be better to use the + operator to merge the arrays, that way the option numbers will be preserved.

formbuilder.php version:
* @version $Id: FormBuilder.php,v 1.189 2005/06/17 16:32:41 justinpatrin Exp $

Reproduce code:
---------------
...
if (in_array($key, $this->selectAddEmpty)
|| !($type & DB_DATAOBJECT_NOTNULL)) {
$options = array_merge(array('' => $this->selectAddEmptyLabel), $options);
}
...

[2005-07-21 06:42 UTC] evt at infoware dot com dot au

Works perfectly, thanks.

[2005-07-21 06:42 UTC] evt at infoware dot com dot au

Works perfectly, thanks.