fossar / selfoss

multipurpose rss reader, live stream, mashup, aggregation web application
https://selfoss.aditu.de
GNU General Public License v3.0
2.35k stars 344 forks source link

Can't create a new sqlite3 database in selfoss 2.19 on FreeBSD. #1488

Closed prbernard closed 6 days ago

prbernard commented 6 days ago

Fresh install of selfoss 2.19 on FreeBSD 14.1-RELEASE-p2 nginx version 1.24.0_16,3 sqlite3 version 3.45.1,1 php version 8.3.6

When an attempt is made to create a new sqlite database the following error is listed in ../logs/default.log:

[2024-07-05 20:56:22] selfoss.ERROR: SQLSTATE[HY000]: General error: 1 no such column: table {"exception":"[object] (PDOException(code: HY000): SQLSTATE[HY000]: General error: 1 no such column: table at /usr/local/www/nginx/selfoss/src/helpers/DatabaseConnection.php:144)
[stacktrace]
#0 /usr/local/www/nginx/selfoss/src/helpers/DatabaseConnection.php(144): PDO->prepare()
#1 /usr/local/www/nginx/selfoss/src/helpers/DatabaseConnection.php(193): helpers\\DatabaseConnection->execute()
#2 /usr/local/www/nginx/selfoss/src/daos/CommonSqlDatabase.php(27): helpers\\DatabaseConnection->exec()
#3 /usr/local/www/nginx/selfoss/src/daos/sqlite/Database.php(38): daos\\sqlite\\Database->exec()
#4 [internal function]: daos\\sqlite\\Database->__construct()
...

Changing line 38 in /selfoss/src/daos/sqlite/Database.php from

$result = @$this->exec('SELECT name FROM sqlite_master WHERE type = "table"');

to

$result = @$this->exec("SELECT name FROM sqlite_master WHERE type = 'table'");

solves the problem and allows the database to be created.

jtojnar commented 6 days ago

Thanks for reporting, should be fixed now.

I went through the code base and did not see any other instances other than in some dead code, which I removed.