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

Can't edit a role (PHP.trigger_error fatal error)

K17K17 Français / French Paris, France ✭✭✭
edited September 2017 in Vanilla 2.0 - 2.8

Hi ^^
I recently moved a forum to a new one using the porter.
But now I couldn't edit roles from dashboard, I get the following error:

Fatal Error in PHP.trigger_error();
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' p.Name as `Name` from GDN_c `c` left join GDN_p `p` on c. = p.ID' at line 1


The error occurred on or near: /home/u357695109/public_html/library/database/class.database.php
408:                 // If we get here then the pdo statement prepared properly.
409:                 break;
410: 
411:             } catch (Gdn_UserException $uex) {
412:                 trigger_error($uex->getMessage(), E_USER_ERROR);
413:             } catch (Exception $ex) {
414:                 list($state, $code, $message) = $PDO->errorInfo();
415: 
416:                 // If the error code is consistent with a disconnect, attempt to retry


Backtrace:
/home/u357695109/public_html/library/database/class.database.phpPHP::Gdn_ErrorHandler();
[/home/u357695109/public_html/library/database/class.database.php:412] PHP::trigger_error();
[/home/u357695109/public_html/library/database/class.sqldriver.php:1663] Gdn_Database->query();
[/home/u357695109/public_html/library/database/class.sqldriver.php:614] Gdn_SQLDriver->query();
[/home/u357695109/public_html/applications/dashboard/models/class.permissionmodel.php:591] Gdn_SQLDriver->get();
[/home/u357695109/public_html/applications/dashboard/models/class.permissionmodel.php:707] PermissionModel->getJunctionPermissions();
[/home/u357695109/public_html/applications/dashboard/models/class.permissionmodel.php:755] PermissionModel->getPermissions();
[/home/u357695109/public_html/applications/dashboard/controllers/class.rolecontroller.php:145] PermissionModel->getPermissionsEdit();
[/home/u357695109/public_html/applications/dashboard/controllers/class.rolecontroller.php:145] RoleController->edit();
[/home/u357695109/public_html/library/core/class.dispatcher.php:326] PHP::call_user_func_array();
[/home/u357695109/public_html/index.php:44] Gdn_Dispatcher->dispatch();

Variables in local scope:
[Sql] 'select distinct p.ID as `ID`, c., p.Name as `Name`
from GDN_c `c`
left join GDN_p `p` on c. = p.ID'
[InputParameters] array (
)
[Options] array (
  'Type' => 'select',
  'Slave' => NULL,
  'ReturnType' => 'DataSet',
)
[ReturnType] 'DataSet'
[tries] 2
[try] 0
[PDO] array (
)
[PDOStatement] false
[state] '42000'
[code] 1064
[message] 'You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near \' p.Name as `Name`
from GDN_c `c`
left join GDN_p `p` on c. = p.ID\' at line 1'
[uex] array (
)

I have on the same server (PHP 5.6 with MySql/MariaDB 10.1 - Vanilla 2.3.1) but who do not have this problem and works perfectly (he was a fresh forum, not using the porter)

Could you help me ? I hope I give the necessary informations ^^

Comments

  • Options
    R_JR_J Ex-Fanboy Munich Admin
    edited September 2017

    When you look at that part of the message above, you will see that the problem comes partly from querying a table with a filed ID:

    Variables in local scope:
    [Sql] 'select distinct p.ID as `ID`, c., p.Name as `Name`
    from GDN_c `c`
    left join GDN_p `p` on c. = p.ID'
    [InputParameters] array (
    

    Vanila uses quite descriptive names and IDs always are named after their table: UserID, CommentID, ..

    I would guess that this problem comes from using some plugin, I don't know which, though...

  • Options
    K17K17 Français / French Paris, France ✭✭✭
    edited September 2017

    Oh yes @R_J I didn't mind about plugins ^^ I disable them and make a feedback ^^

    EDIT: Same without any plugin or app enabled :/
    This error happen only when editing/adding/deleting a role

  • Options
    K17K17 Français / French Paris, France ✭✭✭
    edited September 2017

    I think I have a database problem because I exported the forum, and imported it in a locale copy, and this one (the fresh install without any addon, locale or nothing. Just installed and imported) have now the same problems.

  • Options
    K17K17 Français / French Paris, France ✭✭✭

    Okay don't know where the problem was but now it's done, the table GDN_Permissions had a problem. I replace it with a one from a fresh install and now everything works. Don't know why but now this works.

    I forgot to use the QnA features but if I could put it as resolved I'll do it ^^

  • Options

    Great you managed to solve your problem, even though we're still not sure what caused it! :P

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    There has been a problem with plugins using the 'RegisterPermissions' false which created a column in the permission table titled "1". Maybe that had happened

  • Options
    K17K17 Français / French Paris, France ✭✭✭
    edited September 2017

    Yes @R_J mabybe this happened but I'm not sure, this happened only after using the porter, the original database works fine too.

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    Source and target have been Vanilla forums? Then you do not need and you should not use the porter. The porter is only made for exporting non-Vanilla forums in order to import them to Vanilla.

Sign In or Register to comment.