Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Bonk Error when attempting to Edit/Add Roles

r0obertr0obert
edited May 2014 in Vanilla 2.0 - 2.8

Fatal Error in PDOStatement.execute();

PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: parameter was not defined

The error occurred on or near: /home/satforum/public_html/library/database/class.database.php

289:          $PDOStatement = $this->Connection()->prepare($Sql);
290: 
291:          if (!is_object($PDOStatement)) {
292:             trigger_error(ErrorMessage('PDO Statement failed to prepare', $this->ClassName, 'Query', $this->GetPDOErrorMessage($this->Connection()->errorInfo())), E_USER_ERROR);
293:          } else if ($PDOStatement->execute($InputParameters) === FALSE) {  
294:             trigger_error(ErrorMessage($this->GetPDOErrorMessage($PDOStatement->errorInfo()), $this->ClassName, 'Query', $Sql), E_USER_ERROR);
295:          }
296:       } else {
297:          $PDOStatement = $this->Connection()->query($Sql);

What's wrong (line 293)?

Application: Vanilla
Application Version: 2.1
PHP Version: 5.4.27
Operating System: Linux
Server Software: Apache
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36
Request Uri: /role/edit/40
Controller: PDOStatement
Method: execute

«13

Comments

  • Options

    follow these steps and see if the problem goes away.

    http://vanillaforums.org/discussion/comment/199091/#Comment_199091

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    @peregrine said:
    follow these steps and see if the problem goes away.

    http://vanillaforums.org/discussion/comment/199091/#Comment_199091

    change theme to default
    if problem goes away - check your theme for errors
    if problem still occurs
    disable plugins one by one
    if problem is fixed - identify plugin and post question under offending plugin
    if problem still occurs, download core files again.

    • if problem still occurs (no plugins and default theme) , file issue on github.
    • if problem is fixed - you made a change to core that caused the problem.

    I've tried everything you said, including chmod smarty/compile to 777 and clearing .ini files from cache.

    Still not working. I inserted this $Configuration['Garden']['Errors']['MasterView'] = 'deverror.master.php'; in my config.php and now I get this error (line 294 in library/database/class.database.php):

    Fatal Error in Gdn_Database.Query();

    290: 
    291:          if (!is_object($PDOStatement)) {
    292:             trigger_error(ErrorMessage('PDO Statement failed to prepare', $this->ClassName, 'Query', $this->GetPDOErrorMessage($this->Connection()->errorInfo())), E_USER_ERROR);
    293:          } else if ($PDOStatement->execute($InputParameters) === FALSE) {
    294:             trigger_error(ErrorMessage($this->GetPDOErrorMessage($PDOStatement->errorInfo()), $this->ClassName, 'Query', $Sql), E_USER_ERROR);
    295:          }
    296:       } else {
    297:          $PDOStatement = $this->Connection()->query($Sql);
    298:       }
    

    What next? Should I do a fresh vanilla install on my server and if it's still not working file issue on github?

    Any thoughts would be appreciated, thanks!

  • Options
    peregrineperegrine MVP
    edited May 2014

    Should I do a fresh vanilla install on my server

    and see if it works. (could be your role table or something is corrupted).

    so a fresh install might be the ticket,

    that is what i would do, others might do something different.

    try a fresh install and see what happens, obviously you have pdo enabled and you are not in mysql strict mode - correct?

    I can edit roles and so can others, so if a fresh install doesn't solve issue, you have either an edge case or your php doesn't have the correct extensions or all the extensions it needs (i guess).

    Although I don't use php 5.4, but certainly others are using php 5.4 and not having issues.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    @peregrine said:
    could be your role table or something is corrupted
    try a fresh install and see what happens, obviously you have pdo enabled and you are not in mysql strict mode - correct?

    I'm not sure how to check for that really.

    I did a fresh install w/o importing my db and it worked. What next?

  • Options
    peregrineperegrine MVP
    edited May 2014

    what do you want to do next?

    you might have a corrupted roles and/or permissions table. I would create a mysql dump (backup) of the role table and permissionss table for the newly installed database.

    use phpmyadmin to import the old db data. make sure you empty tables before you import.

    then clear the .ini files and do /utility/update and utility/structure.

    if you still can't edit after the import, load the permissions and role table that you dumped earlier from new install (after you empty) and go through all the permissions in dashboard with a fine tooth comb to set how you want. then verify all users have valid roles.

    If you run into the problem because you have a huge amount of roles that could be the problem.

    then enable plugins.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    r0obertr0obert
    edited May 2014

    @peregrine thanks!

    I just want to get this straight so I don't mess up in phpmyadmin:

    I would create a mysql dump (backup) of the role table and permissionss table for the newly installed database.

    basically export GDN_Permission & GDN_Role for my fresh install?

    use phpmyadmin to import the old db data. make sure you empty tables before you import.

    truncate my old tables and import the ones I exported in the step above? or import old tables into the new install after dumping + emptying them?

    Sorry for the confusion, but I'm not entirely sure what we're trying to accomplish.

  • Options
    peregrineperegrine MVP
    edited May 2014

    @r0obert said:
    peregrine thanks!

    I just want to get this straight so I don't mess up in phpmyadmin:

    obviously make sure you have backups of your real data.

    step 1:

    basically export GDN_Permission & GDN_Role from my fresh install?

    yes.

    step 2:

    truncate my old tables and import the ones I exported in the step above? or import old tables into the new install after dumping + emptying them?

    truncate the tables in the freshly created vanilla that you said worked.
    import the ones from your old live database into the new fresh install.

    if there was corruption, this may even help - just the act of importing via phpmyadmin.

    run utility/update utility/structure and clear the .ini
    if you still get the same error.

    truncate GDN_Permission & GDN_Role in the new install.

    import the the two tables that you dumped from step 1

    go through all the permissions in dashboard with a fine tooth comb to set how you want. then verify all users have valid roles.

    If you run into the problem because you have a huge amount of roles that could be the problem.

    then enable plugins.

    run utility/update utility/structure and clear the .ini

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    r0obertr0obert
    edited May 2014
    1. exported GDN_Permission & GDN_Role (new install)
    2. truncated both tables (new install)
    3. exported both tables (old install)
    4. tried to import them into new install, but got error for GDN_Permission (GDN_Role imported correctly):
      #1054 - Unknown column 'Garden.Applicants.Manage' in 'field list'

    more info:

    Error: 1054 SQLSTATE: 42S22 (ER_BAD_FIELD_ERROR)

    Message: Unknown column '%s' in '%s'

  • Options

    3) export the whole database from your old live installation.

    there will be options for export in phpmyadmin.

    options:

    export - structure and data
    
    check all these below
    
    Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT statement
    Add CREATE PROCEDURE / FUNCTION / EVENT statement
    CREATE TABLE options:
    
        IF NOT EXISTS
        AUTO_INCREMENT
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    r0obertr0obert
    edited May 2014

    @peregrine said:
    3) export the whole database from your old live installation.

    there will be options for export in phpmyadmin.

    options:

    export - structure and data
    
    check all these below
    
    Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT statement
    Add CREATE PROCEDURE / FUNCTION / EVENT statement
    CREATE TABLE options:
    
        IF NOT EXISTS
        AUTO_INCREMENT
    

    Done.

    Import has been successfully finished.

  • Options

    and does it work?

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    @peregrine said:
    and does it work?

    No, same error. I also did run utility/update utility/structure and cleared the .ini files.

  • Options

    if you still can't edit after the import, load the permissions and role table that you dumped earlier from new install (after you empty) and go through all the permissions in dashboard with a fine tooth comb to set how you want. then verify all users have valid roles.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    @peregrine said:

    if you still can't edit after the import, load the permissions and role table that you dumped earlier from new install (after you empty) and go through all the permissions in dashboard with a fine tooth comb to set how you want. then verify all users have valid roles.

    And after I've done all that, how do I move the new install back to root on my server (it's currently in /folder)?

  • Options

    first see if it works then we can worry about the rest.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    peregrineperegrine MVP
    edited May 2014

    how do I move the new install back to root on my server (it's currently in /folder)?

    we assume the source code is the same in both installations because you said that earlier in this thread.

    if the new datatabase works for you and you can edit roles. and you've double checked all users for the correct roles. and you've checked the permissions for each role and everything is the way you want it with all discussions and comments and everything else correct.

    and you are absolutely sure you like it. the new one, that is.

    then just modify the config.php in your root. (the old installation)

    take the following statements from the (newinstallation config.php.) and paste them in to your root installation config and you will essentially just swap databases to your old installation.

    $Configuration['Database']['Name'] = '...
    $Configuration['Database']['Host'] = ...
    $Configuration['Database']['User'] = '...
    $Configuration['Database']['Password'] = ...
    

    delete the ini files in cache

    and

    run/utility/update.

    enable all plugins.

    and double check roles and permissions are what you want for each role and users have correct roles again.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    r0obertr0obert
    edited May 2014

    @peregrine said:

    if you still can't edit after the import, load the permissions and role table that you dumped earlier from new install (after you empty) and go through all the permissions in dashboard with a fine tooth comb to set how you want. then verify all users have valid roles.

    Done.

    @peregrine said:
    first see if it works then we can worry about the rest.

    Still not working.

    Fatal Error in PDOStatement.execute();

    PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: parameter was not defined (line 293)

    289:          $PDOStatement = $this->Connection()->prepare($Sql);
    290: 
    291:          if (!is_object($PDOStatement)) {
    292:             trigger_error(ErrorMessage('PDO Statement failed to prepare', $this->ClassName, 'Query', $this->GetPDOErrorMessage($this->Connection()->errorInfo())), E_USER_ERROR);
    293:          } else if ($PDOStatement->execute($InputParameters) === FALSE) {
    294:             trigger_error(ErrorMessage($this->GetPDOErrorMessage($PDOStatement->errorInfo()), $this->ClassName, 'Query', $Sql), E_USER_ERROR);
    295:          }
    296:       } else {
    297:          $PDOStatement = $this->Connection()->query($Sql);
    

    A few notes:
    a) I keep getting logged off while trying to make changes to roles/permissions

    b) I keep getting Need to re-index theme cache/Need to re-index plugin cache message

    c) I can edit Admin role, but not when it comes to custom category permissions (I get that error)

    d) I can create new role, but I get error if I save it (no matter the changes) and when I go back to the Roles & Permissions (after closing error screen) I can see that role there, BUT it has zero permissions set, it's blanc

  • Options
    peregrineperegrine MVP
    edited May 2014

    what did you do. you give me error, but you say not what step you are at and what you did so far.

    (don't say everything) tell me step by step what you did.

    A few notes: - I keep getting logged off while trying to make changes to roles/permissions -

    you can't have two different vanilla's running in the same browser, unless you change one of the config.php's to reflect different cookies.

    put this in one of the configs, if you are running both vanilla's at the same time.

    $Configuration['Garden']['Cookie']['Name'] = 'vanilla21';

    I keep getting Need to re-index theme cache/Need to re-index plugin cache message

    its normal.

    I can edit Admin role, but not when it comes to custom category permissions

    go into categories and try to edit there.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    r0obertr0obert
    edited May 2014

    @peregrine said:
    what did you do. you give me error, but you say not what step you are at and what you did so far.

    (don't say everything) tell me step by step what you did.

    @peregrine said:

    >

    if you still can't edit after the import, load the permissions and role table that you dumped earlier from new install (after you empty) and go through all the permissions in dashboard with a fine tooth comb to set how you want. then verify all users have valid roles.

    Done this. Loaded the permissions+role tables that I dumped from the new db into the new install and when I tried to go through all the permissions I got that error again.

  • Options
    peregrineperegrine MVP
    edited May 2014

    I understand now.

    can you edit the categories by going into categories.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.