Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
yched CreditAttribution: yched commentedYes, 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 ?
Comment #2
KarenS CreditAttribution: KarenS commentedI'll get it.
Comment #3
KarenS CreditAttribution: KarenS commentedFixed.
Comment #4
yched CreditAttribution: yched commentedthx :-)
Comment #5
(not verified) CreditAttribution: commented