My-Little-Forum / mylittleforum

A simple PHP and MySQL based internet forum that displays the messages in classical threaded view (tree structure)
GNU General Public License v3.0
118 stars 47 forks source link

IPv6 addresses are too long for database column #681

Closed lfuerderer closed 4 months ago

lfuerderer commented 10 months ago

When I access the forum over IPv6, a php error is thrown, because my client ip address does not fit into the database field (mlf2_useronline.ip with type char(15))

error message:

PHP Fatal error:  Uncaught mysqli_sql_exception: Data too long for column 'ip' at row 1 in /var/www/html/includes/functions.inc.php:1232
Stack trace:
#0 /var/www/html/includes/functions.inc.php(1232): mysqli_query()
#1 /var/www/html/includes/main.inc.php(263): user_online()
#2 /var/www/html/index.php(36): include('...')
#3 {main}
  thrown in /var/www/html/includes/functions.inc.php on line 1232

I use version 20220803.1 of mylittleforum see the error location in the code

I think, the type of the ip column should be char(39) so that every IPv4 and IPv6 address can fit in.

auge8472 commented 10 months ago

Your observation is correct. We discussed the issue of HTTP-status 500 for some users of a few forums in some cases and came to the same conclusion. See the following entry in the project forum and the complete thread for details.

Nevertheless thank you for your investigation and report.