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

Formbuilder converts NULL to ''

Details

Submitted2004-05-24 11:58 UTC
Frommartind at boltblue dot com
Assignedmw21st
StatusBogus
PackageDB_DataObject_FormBuilder
PHP Version4.3.4
OSLinux (Fedora core 1)
Roadmaps(Not assigned)

Comments

[2004-05-24 11:58 UTC] martind at boltblue dot com

Description:
------------
Version 0.9.0 of DB_DataObject_FormBuilder.php
Version 1.5.3 of DB_DataObject

When adding an empty option to a drop down combobox, processForm always inserts a '0' rather than a NULL into the database.

Reproduce code:
---------------
function preProcess(&$values)
{
if ($values['issue_global_id'] == '') {
$this->issue_global_id = NULL;
}
}

Expected result:
----------------
my issue_global_id value is converted to 0 as opposed to NULL in processForm.

Actual result:
--------------
FormBuilder: Field issue_global_id

FormBuilder: is substituted with ''.

FormBuilder: Field __submit__

FormBuilder: is defined not to be editable by the user!

dataobject_cust_issue: 3: got keys as a:1:{i:0;s:8:"issue_id";}
dataobject_cust_issue: QUERY: UPDATE cust_issue SET customer_id = 8 , supplier_id = 1 , user_id = 2 , subject = 'Flash memory' , part_number = '' , date = '2004-1-20' , description = 'Customer is looking at Flash Memory. This looks like a definate one and will go into volume.\r\n\r\nRequires 3.3V, 32Mb, FBGA.' , live = 1 , timesheet = 1 , issue_global_id = 0 WHERE cust_issue.issue_id = 3
dataobject_cust_issue: query: QUERY DONE IN 0.038150787353516 seconds
dataobject_cust_issue: 1: Clearing Cache for dataobject_cust_issue

FormBuilder: Object updated.

[2004-05-25 08:00 UTC] martind at boltblue dot com

Hi Markus,

Thanks for your reply.

I had actually tried this (sorry I should have mentioned that), but I tried it again for good measure.

if ($values['issue_global_id'] == '') {

$this->issue_global_id = DB_DataObject_Cast::sql('NULL');

}

I also gave

$this->issue_global_id = 'NULL';

just in case.

A '0' is still replacing my NULL value.

Best Regards,

Martin.