6.0.0-beta1
8/14/25

[#9090] First time login : error in sql query - single quote
Summary First time login : error in sql query - single quote
Queue Turba
Queue Version Git master
Type Bug
State Resolved
Priority 1. Low
Owners
Requester rsalmon (at) mbpgroup (dot) com
Created 06/10/2010 (5544 days ago)
Due
Updated 07/05/2010 (5519 days ago)
Assigned 06/15/2010 (5539 days ago)
Resolved 07/05/2010 (5519 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
07/05/2010 03:01:31 PM Jan Schneider State ⇒ Resolved
 
07/05/2010 02:41:50 PM rsalmon (at) mbpgroup (dot) com Comment #7 Reply to this comment
This is well possible.
I don't get this error any more.
I haven't updated anything but horde.

06/28/2010 12:34:04 PM Jan Schneider Comment #6 Reply to this comment
This is well possible.
06/28/2010 09:12:55 AM rsalmon (at) mbpgroup (dot) com Comment #5 Reply to this comment
I have MySQL 5.1.45 installed.

If found out that (horde/config/conf.php) :
- $conf['sql']['phptype'] = 'mysqli'; -> Fatal error

- $conf['sql']['phptype'] = 'mysql'; -> Everything OK!

Can this be a MDB2 bug ?

06/15/2010 12:05:47 PM Jan Schneider Comment #4 Reply to this comment
That's not very helpful either. Without a better error message, I'm 
not sure how to proceed.
06/15/2010 10:13:29 AM rsalmon (at) mbpgroup (dot) com Comment #3 Reply to this comment
What makes you think this has anything to do with single quotes?
You are probably right, at first I though it was the value for 
attribute_name that wasn't correctly set.

If I manually run the query 'INSERT INTO turba_shares...', everything 
then is working fine.
Do you see anything in the mysql logs that you didn't tell us?
No, I don't see anything wrong but here is the log.
100615 12:40:29          273 Connect        horde@localhost on horde
                  273 Query        SHOW CHARACTER SET
                  273 Query        SET NAMES 'utf8'
                  274 Connect        horde@localhost on horde
                  274 Query        SHOW CHARACTER SET
                  274 Query        SET NAMES 'utf8'
                  274 Query        SELECT pref_scope, pref_name, pref_value FROM 
horde_prefs WHERE pref_uid = 'ronan' AND pref_scope = 'horde'
                  274 Query        SELECT pref_scope, pref_name, pref_value FROM 
horde_prefs WHERE pref_uid = 'ronan' AND pref_scope = 'imp'
                  275 Connect        horde@localhost on horde
                  275 Query        SHOW CHARACTER SET
                  275 Query        SET NAMES 'utf8'
                  275 Query        SELECT COUNT(*) FROM horde_perms WHERE perm_name = 'turba'
                  274 Query        SELECT pref_scope, pref_name, pref_value FROM 
horde_prefs WHERE pref_uid = 'ronan' AND pref_scope = 'turba'
                  276 Connect        horde@localhost on horde
                  277 Connect        horde@localhost on horde
                  277 Query        SHOW CHARACTER SET
                  277 Query        SET NAMES 'utf8'
                  277 Query        SELECT g.group_uid AS group_uid, g.group_name AS 
group_name FROM horde_groups g, horde_groups_members m  WHERE 
m.user_uid = 'ronan' AND g.group_uid = m.group_uid ORDER BY g.group_name
                  276 Init DB        horde
                  276 Query        SELECT DISTINCT s.*  FROM turba_shares s  LEFT JOIN 
turba_shares_users u ON u.share_id = s.share_id WHERE s.share_owner = 
'ronan' OR (s.perm_creator & 4) OR (s.perm_default & 4) OR ( 
u.user_uid = 'ronan' AND (u.perm & 4)) ORDER BY s.share_name ASC
                  278 Connect        horde@localhost on horde
                  276 Init DB        horde
                  276 Query        INSERT INTO turba_shares_seq (id) VALUES (NULL)
                  276 Init DB        horde
                  276 Query        SELECT LAST_INSERT_ID()
                  276 Init DB        horde
                  276 Query        DELETE FROM turba_shares_seq WHERE id < 41
                  276 Prepare        INSERT INTO turba_shares (share_name, share_owner, 
attribute_name, attribute_params, perm_creator, perm_default, 
perm_guest, share_flags, share_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
                  273 Quit
                  274 Quit
                  275 Quit
                  277 Quit
                  278 Quit
                  276 Quit
What do you get in the Horde log, if you log $result->toString() 
instead of $result in that line?
[mdb2_error: message="MDB2 Error: unknown error" code=-1 mode=return 
level=notice prefix="" info="_execute: [Error message: Unable to 
execute statement]
[Last executed query: INSERT INTO turba_shares (share_name, 
share_owner, attribute_name, attribute_params, perm_creator, 
perm_default, perm_guest, share_flags, share_id) VALUES (?, ?, ?, ?, 
?, ?, ?, ?, ?)]
[Native code: 0]
"] [pid 13247 on line 158 of 
"/var/www/html/horde/libs/Horde/Share/Object/Sql.php"]






Here is horde.log.
I have pear/MDB2 version 2.4.1 installed
PHP Version: 5.3.2
PEAR Version: 1.9.0


2010-06-15T12:53:35+02:00 DEBUG: HORDE [turba] SQL  (0,0007s)
        SELECT pref_scope, pref_name, pref_value FROM horde_prefs WHERE
          pref_uid = 'rsalmon' AND pref_scope = 'turba' [pid 14812 on line 
749 of "/var/www/html/horde/libs/Horde/Db/Adapter/Base.php"]
2010-06-15T12:53:35+02:00 DEBUG: HORDE [turba] Hook pushapp in 
application turba not called. [pid 14812 on line 1716 of 
"/var/www/html/horde/libs/Horde.php"]
2010-06-15T12:53:35+02:00 DEBUG: HORDE [turba] Assigning the return 
value of new by reference is deprecated [pid 14812 on line 390 of 
"/usr/share/pear/MDB2.php"]
2010-06-15T12:53:35+02:00 DEBUG: HORDE [turba] Assigning the return 
value of new by reference is deprecated [pid 14812 on line 1885 of 
"/usr/share/pear/MDB2.php"]
2010-06-15T12:53:35+02:00 DEBUG: HORDE [turba] Assigning the return 
value of new by reference is deprecated [pid 14812 on line 2572 of 
"/usr/share/pear/MDB2.php"]
2010-06-15T12:53:35+02:00 DEBUG: HORDE [turba] Assigning the return 
value of new by reference is deprecated [pid 14812 on line 2595 of 
"/usr/share/pear/MDB2.php"]
2010-06-15T12:53:35+02:00 DEBUG: HORDE [turba] Assigning the return 
value of new by reference is deprecated [pid 14812 on line 2940 of 
"/usr/share/pear/MDB2.php"]
2010-06-15T12:53:35+02:00 DEBUG: HORDE [turba] Assigning the return 
value of new by reference is deprecated [pid 14812 on line 940 of 
"/usr/share/pear/MDB2/Driver/mysqli.php"]
2010-06-15T12:53:35+02:00 DEBUG: HORDE [turba] Assigning the return 
value of new by reference is deprecated [pid 14812 on line 1206 of 
"/usr/share/pear/MDB2/Driver/mysqli.php"]
2010-06-15T12:53:35+02:00 DEBUG: HORDE [turba] Hook share_init in 
application horde not called. [pid 14812 on line 1716 of 
"/var/www/html/horde/libs/Horde.php"]
2010-06-15T12:53:35+02:00 DEBUG: HORDE [turba] SQL  (0,0003s)
        SELECT g.group_uid AS group_uid, g.group_name AS group_name FROM
          horde_groups g, horde_groups_members m WHERE m.user_uid = 'rsalmon'
          AND g.group_uid = m.group_uid ORDER BY g.group_name [pid 14812 on 
line 749 of "/var/www/html/horde/libs/Horde/Db/Adapter/Base.php"]
2010-06-15T12:53:35+02:00 DEBUG: HORDE [turba] SQL Query by 
Horde_Share_sql::listShares: SELECT DISTINCT s.*  FROM turba_shares s   
LEFT JOIN turba_shares_users u ON u.share_id = s.share_id WHERE 
s.share_owner = 'rsalmon' OR (s.perm_creator & 4) OR (s.perm_default & 
4) OR ( u.user_uid = 'rsalmon' AND (u.perm & 4)) ORDER BY s.share_name 
ASC [pid 14812 on line 477 of 
"/var/www/html/horde/libs/Horde/Share/Sql.php"]
2010-06-15T12:53:35+02:00 DEBUG: HORDE [turba] Hook share_list in 
application horde not called. [pid 14812 on line 1716 of 
"/var/www/html/horde/libs/Horde.php"]
2010-06-15T12:53:35+02:00 DEBUG: HORDE [turba] Hook share_add in 
application horde not called. [pid 14812 on line 1716 of 
"/var/www/html/horde/libs/Horde.php"]
2010-06-15T12:53:35+02:00 DEBUG: HORDE [turba] Hook share_modify in 
application horde not called. [pid 14812 on line 1716 of 
"/var/www/html/horde/libs/Horde.php"]
2010-06-15T12:53:35+02:00 INFO: HORDE [turba] 1 [pid 14812 on line 158 
of "/var/www/html/horde/libs/Horde/Share/Object/Sql.php"]
2010-06-15T12:53:35+02:00 ERR: HORDE [turba] MDB2 Error: unknown 
error: _execute: [Error message: Unable to execute statement]
[Last executed query: INSERT INTO turba_shares (share_name, 
share_owner, attribute_name, attribute_params, perm_creator, 
perm_default, perm_guest, share_flags, share_id) VALUES (?, ?, ?, ?, 
?, ?, ?, ?, ?)]
[Native code: 0]
  [pid 14812 on line 160 of 
"/var/www/html/horde/libs/Horde/Share/Object/Sql.php"]
2010-06-15T12:53:35+02:00 ERR: HORDE [turba] MDB2 Error: unknown error 
[pid 14812 on line 161 of 
"/var/www/html/horde/libs/Horde/Share/Object/Sql.php"]
2010-06-15T12:53:35+02:00 ERR: HORDE [imp] MDB2 Error: unknown error 
[pid 14812 on line 575 of "/var/www/html/horde/turba/lib/Turba.php"]
2010-06-15T12:53:35+02:00 EMERG: HORDE [imp] MDB2 Error: unknown error 
[pid 14812 on line 575 of "/var/www/html/horde/turba/lib/Turba.php"]

06/15/2010 09:19:58 AM Jan Schneider Comment #2
State ⇒ Feedback
Reply to this comment
What makes you think this has anything to do with single quotes? Do 
you see anything in the mysql logs that you didn't tell us?
What do you get in the Horde log, if you log $result->toString() 
instead of $result in that line?
06/10/2010 03:15:57 PM rsalmon (at) mbpgroup (dot) com Comment #1
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ First time login : error in sql query - single quote
Queue ⇒ Turba
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
Reply to this comment
we use mysql

First time a user logs in, I get the folowing error :
MDB2 Error: unknown error

From /tmp/horde.log :
ERR: HORDE [turba] MDB2 Error: unknown error: _execute: [Error 
message: Unable to execute statement]
[Last executed query: INSERT INTO turba_shares (share_name, 
share_owner, attribute_name, attribute_params, perm_creator, 
perm_default, perm_guest, share_flags, share_id) VALUES (?, ?, ?, ?, 
?, ?, ?, ?, ?)]
[Native code: 0]
  [pid 13193 on line 157of 
"/var/www/html/horde/libs/Horde/Share/Object/Sql.php"]


From debuging :

$params = (
     [0] => ce4e0f4be99b33113ba0a0bf47bcf31b
     [1] => rsalmon
     [2] => Ronan SALMON's Address Book
     [3] => 
a:3:{s:6:"source";s:8:"localsql";s:7:"default";b:1;s:4:"name";s:7:"rsalmon";}
     [4] => 0
     [5] => 0
     [6] => 0
     [7] => 0
     [8] => 32
)

If I run the following query from mysql command line (with double 
quotes in attribute_name), I then can log in :
  INSERT INTO turba_shares (share_name, share_owner, attribute_name, 
attribute_params, perm_creator, perm_default, perm_guest, share_flags, 
share_id) VALUES ( 'ce4e0f4be99b33113ba0a0bf47bcf31b','rsalmon','Ronan 
SALMON''s Address 
Book','a:3:{s:6:"source";s:8:"localsql";s:7:"default";b:1;s:4:"name";s:7:"rsalmon";}',0,0,0,0,32);




Saved Queries