Closed (fixed)
Project:
Ubercart
Version:
7.x-3.0-beta4
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Sep 2011 at 04:15 UTC
Updated:
28 Oct 2011 at 17:50 UTC
When adding a new option to an attribute I get an error if I leave the cost field empty (as in, I delete the default 0.00) and then click save. The following error below prints out:
Notice: Uninitialized string offset: 0 in uc_attribute_option_form_validate() (line 462 of /home/user/public_html/sites/all/modules/ubercart/uc_attribute/uc_attribute.admin.inc).
Notice: Uninitialized string offset: 0 in uc_attribute_option_form_validate() (line 462 of /home/user/public_html/sites/all/modules/ubercart/uc_attribute/uc_attribute.admin.inc).
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect decimal value: '' for column 'cost' at row 1: INSERT INTO {uc_attribute_options} (aid, name, cost, price, weight, ordering) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5); Array ( [:db_insert_placeholder_0] => 2 [:db_insert_placeholder_1] => test option [:db_insert_placeholder_2] => [:db_insert_placeholder_3] => 0.00 [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => 0 ) in drupal_write_record() (line 6861 of /home/user/public_html/includes/common.inc).
Comments
Comment #1
jeremyr commentedOf course the obvious solution would be to leave the 0.00 in the field, but that would be too easy... ;)
Comment #2
longwaveThe latest patches in #1243762: Make field validation more consistent include a fix for this, testing would be appreciated.
Comment #3
longwaveThe patch in the above issue has been committed, so this is now fixed.