zlsl / flibusta

Фронтенд для архивов Флибусты
GNU General Public License v2.0
163 stars 28 forks source link

ERROR: invalid input syntax for type uuid: "" #8

Closed imcitius closed 1 month ago

imcitius commented 1 month ago

Свежая установка, база обновлена и архивы пересканированы. В целом все работает, книги скачиваются.

При обращении на страницу любого автора http://.../author/view/5000 получаю 500-й ответ от сервера.

В логе контейнеров следующее:

postgres-1   | 2024-09-28 14:48:41.580 UTC [672] ERROR:  invalid input syntax for type uuid: ""
postgres-1   | 2024-09-28 14:48:41.580 UTC [672] STATEMENT:  SELECT COUNT(*) cnt FROM fav WHERE user_uuid=$1 AND avtorid=$2
php-fpm-1    | NOTICE: PHP message: PHP Fatal error:  Uncaught PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax for type uuid: "" in /application/modules/author/index.php:20
php-fpm-1    | Stack trace:
php-fpm-1    | #0 /application/modules/author/index.php(20): PDOStatement->execute()
php-fpm-1    | #1 /application/renderer.php(125): include('/application/mo...')
php-fpm-1    | #2 /application/public/index.php(143): include('/application/re...')
php-fpm-1    | #3 {main}
php-fpm-1    |   thrown in /application/modules/author/index.php on line 20
php-fpm-1    | 172.22.0.3 -  28/Sep/2024:14:48:41 +0000 "GET /index.php" 500
webserver-1  | 2024/09/28 14:48:41 [error] 33#33: *470 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax for type uuid: "" in /application/modules/author/index.php:20
webserver-1  | Stack trace:
webserver-1  | #0 /application/modules/author/index.php(20): PDOStatement->execute()
webserver-1  | #1 /application/renderer.php(125): include('/application/mo...')
webserver-1  | #2 /application/public/index.php(143): include('/application/re...')
webserver-1  | #3 {main}
webserver-1  |   thrown in /application/modules/author/index.php on line 20" while reading response header from upstream, client: 172.22.0.1, server: , request: "GET /author/view/5000 HTTP/1.1", upstream: "fastcgi://172.22.0.4:9000", host: "tower.local:27100"

Похожая ошибка по ссылке /fav:

postgres-1   | 2024-09-28 14:56:06.540 UTC [836] ERROR:  invalid input syntax for type uuid: ""
postgres-1   | 2024-09-28 14:56:06.540 UTC [836] STATEMENT:  SELECT *
postgres-1   |                  FROM fav
postgres-1   |                  LEFT JOIN libavtorname USING(AvtorId)
postgres-1   |                  LEFT JOIN libapics USING(AvtorId)
postgres-1   |                  WHERE user_uuid=$1 AND avtorid IS NOT NULL
php-fpm-1    | NOTICE: PHP message: PHP Fatal error:  Uncaught PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax for type uuid: "" in /application/modules/fav/index.php:8
php-fpm-1    | Stack trace:
php-fpm-1    | #0 /application/modules/fav/index.php(8): PDOStatement->execute()
php-fpm-1    | #1 /application/renderer.php(125): include('/application/mo...')
php-fpm-1    | #2 /application/public/index.php(143): include('/application/re...')
php-fpm-1    | #3 {main}
php-fpm-1    |   thrown in /application/modules/fav/index.php on line 8
php-fpm-1    | 172.22.0.3 -  28/Sep/2024:14:56:06 +0000 "GET /index.php" 500
webserver-1  | 2024/09/28 14:56:06 [error] 33#33: *605 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax for type uuid: "" in /application/modules/fav/index.php:8
webserver-1  | Stack trace:
webserver-1  | #0 /application/modules/fav/index.php(8): PDOStatement->execute()
webserver-1  | #1 /application/renderer.php(125): include('/application/mo...')
webserver-1  | #2 /application/public/index.php(143): include('/application/re...')
webserver-1  | #3 {main}
webserver-1  |   thrown in /application/modules/fav/index.php on line 8" while reading response header from upstream, client: 172.22.0.1, server: , request: "GET /fav/ HTTP/1.1", upstream: "fastcgi://172.22.0.4:9000", host: "tower.local:27100", referrer: "http://tower.local:27100/?page=5"
zlsl commented 1 month ago

Это связано с тем, что ни одной полки книжной не создано. $stmt = $dbh->prepare("SELECT COUNT(*) cnt FROM fav WHERE user_uuid=:uuid AND avtorid=:id");

Соответственно вылетает отображение кнопки "В избранное / Из избранного"

Исправлю

zlsl commented 1 month ago

fixed in 9fceac91b0e12dcc4b87cce3a662e046330d5259