MySQL Invalid Parameter Error

Issue #385 resolved
Karsten Bandlow created an issue

On Login to WebGui following error occurs:

Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in /var/www/htdocs/system/database/mysql.php on line 46

After reload I can use the gui without problems.

Version is Masterbranch

Comments (6)

  1. Janos SUTO repo owner

    Hmm, odd. Can you guess, which is the guilty query? You may add some debugging by editing /var/www/htdocs/system/database/mysql.php, and add the following to the catch block in the 48th line:

    catch(PDOException $exception) { syslog(LOG_INFO, "query: $sql"); }
    
  2. Karsten Bandlow reporter

    Hi Janos, the problem is only a warning, so no PDOExpeption is throwing. I add print_r to see the query and the array.

    Here is the output:

    SELECT u.username, u.uid, u.realname, u.dn, u.password, u.isadmin, u.domain FROM user u, email e WHERE e.email=? AND e.uid=u.uid Array ( [0] => user1@mydomain.com ) INSERT INTO audit (ts, email, domain, action, ipaddr, meta_id, description) VALUES(?,?,?,?,?,?,?) Array ( [0] => 1409122488 [1] => user1@mydomain.com [2] => mydomain.com [3] => 2 [4] => 123.231.214.25 [5] => [6] => successful auth against user table ) SELECT domain FROM domain_user WHERE uid=?Array ( [0] => 1 ) SELECT gid FROM email_groups WHERE uid=?Array ( [0] => 1 ) SELECT email FROM email WHERE uid IN (1) Array ( ) Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in /var/www/piler.mydomain.com/system/database/mysql.php on line 46 SELECT g.email FROM group_email g WHERE g.id IN (SELECT u.id FROM group_user u WHERE u.email IN (?))Array ( [0] => user1@mydomain.com [1] => user5@mydomain.com [2] => user3@mydomain.com [3] => user4@mydomain.com [4] => user1@mydomain.com [5] => praxis@mydomain.com [6] => user2@mydomain.com [7] => user3@mydomain.com ) SELECT id FROM folder_user WHERE uid=?Array ( [0] => 1 ) SELECT id FROM folder_extra WHERE uid=?Array ( [0] => 1 ) SELECT ga_enabled FROM user_settings WHERE username=?Array ( [0] => user1@mydomain.com ) SELECT * FROM user_settings WHERE username=?Array ( [0] => user1@mydomain.com ) INSERT INTO online (username, ts, last_activity, ipaddr) VALUES(?,?,?,?)Array ( [0] => user1@mydomain.com [1] => 1409122488 [2] => 1409122488 [3] => 123.231.214.25 ) Warning: Cannot modify header information - headers already sent by (output started at /var/www/piler.mydomain.com/system/database/mysql.php:47) in /var/www/piler.mydomain.com/controller/login/login.php on line 64

  3. Janos SUTO repo owner

    Well, hell of the job to decrypt this blob :-) Next time please use some bitbucket formatting. I'll check why the 5th query gives a warning.

  4. Janos SUTO repo owner

    No problem, though you may use the formatting icon. Anyway, please check out the latest master branch if it solves the problem.

  5. Log in to comment