syntax errors on some SQL commands in fckeditor.admin.inc

lukeprentice - October 8, 2008 - 01:02
Project:FCKeditor - WYSIWYG HTML editor
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

1. go to "FCKeditor Settings" at /?q=admin/settings/fckeditor
2. select "edit" against the "Default" profile
3. change profile name from "Default" to "Default1"
4. click "Save"
5. the following error was reported:

    * warning: pg_query() [function.pg-query]: Query failed: ERROR: column "Default" does not exist at character 48 in /var/www/drupal-6.4/includes/database.pgsql.inc on line 138.
    * user warning: query: DELETE FROM nz_fckeditor_settings WHERE name = "Default" in /var/www/drupal-sites/all/modules/fckeditor/fckeditor.admin.inc on line 732.
    * warning: pg_query() [function.pg-query]: Query failed: ERROR: column "Default" does not exist at character 44 in /var/www/drupal-6.4/includes/database.pgsql.inc on line 138.
    * user warning: query: DELETE FROM nz_fckeditor_role WHERE name = "Default" in /var/www/drupal-sites/all/modules/fckeditor/fckeditor.admin.inc on line 733.
    * warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "allow_user_conf" at character 85 in /var/www/drupal-6.4/includes/database.pgsql.inc on line 138.
    * user warning: query: INSERT INTO nz_fckeditor_settings (name, settings) VALUES ("Default1", "a:28:{s:15:"allow_user_conf";s:1:"f";s:8:"min_rows";s:1:"1";s:9:"excl_mode";s:1:"0";s:4:"excl";s:0:"";s:11:"simple_incl";s:0:"";s:7:"default";s:1:"t";s:11:"show_toggle";s:1:"t";s:5:"popup";s:1:"f";s:4:"skin";s:7:"default";s:7:"toolbar";s:11:"DrupalBasic";s:6:"expand";s:1:"t";s:5:"width";s:4:"100%";s:4:"lang";s:2:"en";s:9:"auto_lang";s:1:"t";s:10:"enter_mode";s:1:"p";s:16:"shift_enter_mode";s:2:"br";s:11:"font_format";s:35:"p;div;pre;address;h1;h2;h3;h4;h5;h6";s:13:"format_source";s:1:"t";s:13:"format_output";s:1:"t";s:8:"css_mode";s:5:"theme";s:8:"css_path";s:0:"";s:9:"css_style";s:5:"theme";s:11:"styles_path";s:0:"";s:11:"filebrowser";s:4:"none";s:11:"quickupload";s:1:"f";s:13:"UserFilesPath";s:5:"%b%f/";s:21:"UserFilesAbsolutePath";s:7:"%d%b%f/";s:7:"js_conf";s:0:"";}") in /var/www/drupal-sites/all/modules/fckeditor/fckeditor.admin.inc on line 741.
    * warning: pg_query() [function.pg-query]: Query failed: ERROR: column "Default1" does not exist at character 50 in /var/www/drupal-6.4/includes/database.pgsql.inc on line 138.
    * user warning: query: SELECT * FROM nz_fckeditor_settings WHERE name = "Default1" in /var/www/drupal-sites/all/modules/fckeditor/fckeditor.admin.inc on line 1023.
    * warning: pg_query() [function.pg-query]: Query failed: ERROR: column "Default1" does not exist at character 51 in /var/www/drupal-6.4/includes/database.pgsql.inc on line 138.
    * user warning: query: INSERT INTO nz_fckeditor_role (name, rid) VALUES ("Default1", 13) in /var/www/drupal-sites/all/modules/fckeditor/fckeditor.admin.inc on line 746.

i'm using postgres 8.3.4

it seems that the database query had incorrect syntax. it was using double quotes " instead of single quotes ' to surround data.

#1

lukeprentice - October 8, 2008 - 01:29

i have fixed at least those lines that complain by swapping double quotes for single quotes. there may be other places where the syntax is faulty.

i'd recommend using db_query() like this:

db_query("SELECT * FROM {fckeditor_settings} WHERE name = '%s'", $name);

and not like this
db_query('SELECT * FROM {fckeditor_settings} WHERE name = "%s"', $name);

patch is attached (deleted ... see below for more recent patch). please apply.

#2

lukeprentice - October 8, 2008 - 01:11
Status:active» needs review

i've submitted this patch. please test and include.

#3

lukeprentice - October 8, 2008 - 01:29

actually, there were other problems such as deleting a profile.

patch modified and replaced with a more complete one.

AttachmentSize
fckeditor.admin_.inc_.patch 6.27 KB

#4

wwalc - October 8, 2008 - 08:25
Status:needs review» fixed

Ouch! Thanks, I'll try to remember that there are also other RDBMs than MySQL ;)

#5

lukeprentice - October 10, 2008 - 01:03

thanks for thinking of those of us who use more strict RDBMs. :)

#6

Anonymous (not verified) - October 24, 2008 - 01:12
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.