DanWin / le-chat-php

A PHP Chat based on LE CHAT
https://danwin1210.de/chat/
GNU General Public License v3.0
268 stars 98 forks source link

Uncaught TypeError #111

Closed ghost closed 3 years ago

ghost commented 3 years ago

This happens when I login as a guest and as soon as I send a message in the chat. Running PHP 7.3 with MariaDB 10.6 on Debian 10.

2021/08/06 23:04:07 [error] 31382#31382: *72 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught TypeError: Return value of get_filters() must be of the type array, bool returned in /var/www/html/chat/chat.php:1326
Stack trace:
#0 /var/www/html/chat/chat.php(3146): get_filters()
#1 /var/www/html/chat/chat.php(3087): apply_filter('HELLO', 1, 'aaaaaaaaaa')
#2 /var/www/html/chat/chat.php(79): validate_input()
#3 /var/www/html/chat/chat.php(53): route()
#4 {main}
  thrown in /var/www/html/chat/chat.php on line 1326" while reading response header from upstream, client: XXX, server: XXX request: "POST /chat/chat.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.3-fpm.sock:", host: "XXX"

I'm not even sure where that 'aaaaaa' comes from, I think I used it as a password for an earlier test session.

DanWin commented 3 years ago

Thanks for reporting it. I think you have Memcached active in your setup, which at first call doesn't have anything in it's cache and returns a bool false. The cache would then be filled with the actual array found in the database, but as your filter list is probably empty, the bool is never overridden. That's an easy fix. Once applied, you'll have to restart memcached to flush the cache and start fresh. Should work then :)

ghost commented 3 years ago

I think you have Memcached active in your setup

Indeed, thanks for the (hopefully working) fix.