TeamPass icon indicating copy to clipboard operation
TeamPass copied to clipboard

You have an error in your SQL syntax

Open mreinders opened this issue 1 year ago • 2 comments

There are problems with get items api.

I'm trying to get items by ID or label, but getting the understanding error in my php-fpm logging:

PHP Fatal error: Uncaught Exception: 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 ')) ORDER BY i.id ASC' at line 3 in teampass/api/Model/Database.php:51 Stack trace: #0 /var/www/html/teampass/api/Model/ItemModel.php(52): Database->select() #1 /var/www/html/teampass/api/Controller/Api/ItemController.php(221): ItemModel->getItems() #2 /var/www/html/teampass/api/inc/bootstrap.php(59): ItemController->getAction() #3 /var/www/html/teampass/api/index.php(93): itemAction() #4 {main} thrown in /var/www/html/teampass/api/Model/Database.php on line 51

Teampass 3.1.1 is running on RockyLinux 9 with php 8.1 and mariadb 10.11. I tried the API also with php 8.2, but shows the same behaviour. When I remove the query (all code behind the "?"), then all visible passwords are showing up:

{ "error": "Item id, label or description is mandatory" }[ { "id": 1, "label": "test", "description": "", "pwd": "test", "url": "", "login": "test", "email": "", "viewed_no": 0, "fa_icon": "", "inactif": 0, "perso": 0, "id_tree": 1, "folder_label": "test", "path": "" } ]

What do we have to do to query the database from API?

mreinders avatar Dec 11 '23 12:12 mreinders