Just thought I'd throw that into the title so you know it's not yet another dupe of the same bug about how an error crops up if you have no content.

got the following error making an update.

fieldgroup module
Update #2

    * ALTER TABLE {node_group} CHANGE settings settings mediumtext NOT NULL
    * Failed: UPDATE {node_group} SET settings = 'a:2:{s:4:"form";a:4:{s:11:"collapsible";i:0;s:9:"collapsed";i:0;s:8:"multiple";i:0;s:11:"description";s:184:"Select the time when the event begins and ends. If you don't know when it ends, you may leave it blank, but the end time will not be displayed on pages which use it (like in the RBar.)";}s:7:"display";a:3:{s:11:"collapsible";i:0;s:9:"collapsed";i:0;s:11:"description";s:0:"";}}', description = '' WHERE group_name = 'group_times'
    * UPDATE {node_group} SET settings = 'a:2:{s:4:"form";a:4:{s:11:"collapsible";i:1;s:9:"collapsed";i:0;s:8:"multiple";i:0;s:11:"description";s:36:"Additional information on this event";}s:7:"display";a:3:{s:11:"collapsible";i:0;s:9:"collapsed";i:0;s:11:"description";s:0:"";}}', description = '' WHERE group_name = 'group_additional_information'
    * UPDATE {node_group} SET settings = 'a:2:{s:4:"form";a:4:{s:11:"collapsible";i:0;s:9:"collapsed";i:0;s:8:"multiple";i:0;s:11:"description";s:69:"Give information on the type and price (if appropriate) of the event.";}s:7:"display";a:3:{s:11:"collapsible";i:0;s:9:"collapsed";i:0;s:11:"description";s:0:"";}}', description = '' WHERE group_name = 'group_event_information'
    * UPDATE {node_group} SET settings = 'a:2:{s:4:"form";a:4:{s:11:"collapsible";i:0;s:9:"collapsed";i:0;s:8:"multiple";i:0;s:11:"description";s:0:"";}s:7:"display";a:3:{s:11:"collapsible";i:0;s:9:"collapsed";i:0;s:11:"description";s:0:"";}}', description = '' WHERE group_name = 'group_times_and_dates'
    * Failed: UPDATE {node_group} SET settings = 'a:2:{s:4:"form";a:4:{s:11:"collapsible";i:0;s:9:"collapsed";i:0;s:8:"multiple";i:0;s:11:"description";s:142:"Add the promotion's logo image here. Images should be 300x300 pixels. A smaller thumbnail type image will automatically be produced as needed.";}s:7:"display";a:3:{s:11:"collapsible";i:0;s:9:"collapsed";i:0;s:11:"description";s:0:"";}}', description = '' WHERE group_name = 'group_logo'
    * ALTER TABLE {node_group} DROP description

Update #3 worked fine. There is no update #1 :)

I haven't really done any testing yet to see if it's working or not...

Comments

yched’s picture

Yes, stupid mistake - update_sql provides no escaping, so we have to explicitely escape our strings (the failed queries both include a 'single quote' char in the 'description'.

something like
$ret[] = update_sql("UPDATE {node_group} SET settings = '". db_escape_sql(serialize($group['settings'])) ."' WHERE group_name = '". db_escape_sql($group['group_name']) ."'");
instead of
$ret[] = update_sql("UPDATE {node_group} SET settings = '". serialize($group['settings']) ."' WHERE group_name = '". $group['group_name'] ."'");
in fieldgroup.install line 130

I'm away from my coding setup for a few days, so I can't fix this right now. Fago / Karen ?

KarenS’s picture

I'll get it.

KarenS’s picture

Status: Active » Fixed

Fixed.

yched’s picture

thx :-)

Anonymous’s picture

Status: Fixed » Closed (fixed)