Advertisement:

Author Topic: IPv6 inet_aton database error on Subs.php  (Read 460 times)

Offline An_dz

  • Newbie
  • *
  • Posts: 4
IPv6 inet_aton database error on Subs.php
« on: October 06, 2019, 12:38:34 PM »
In our forums SMF is giving the following error (nearly 100% of the times) when accessing it with an IPv6 address. No problems with IPv4.

Quote
Incorrect string value: '''' for function inet_aton
File: /home/sforum/public_html/Sources/Subs.php

The bug is happening on this part of the code:
Code: [Select]
$smcFunc['db_query']('', '
UPDATE {db_prefix}log_online
SET log_time = {int:log_time}, ip = IFNULL(INET_ATON({string:ip}), 0), url = {string:url}
WHERE session = {string:session}',
array(
'log_time' => time(),
'ip' => $user_info['ip'],
'url' => $serialized,
'session' => $session_id,
)
);

I've tried a complete replacement of the Sources and Themes folders with unchanged files from 2.0.15 together with a clean installed.list file to disable all mods and the problem persisted. We've been doing patches since 2.0.7.

I'm puzzled on what's the problem as this part of the code is unchanged from SMF source and a complete reset of the source files still raised the bug.

The database is MySQL 5.7.27 and PHP is 7.2.7.

Offline shadav

  • Full Member
  • ***
  • Posts: 674
  • Gender: Female
    • Ask The Muslims: A Place To Ask Honest Questions and Receive Respectful Answers
Re: IPv6 inet_aton database error on Subs.php
« Reply #1 on: October 06, 2019, 12:50:59 PM »
not sure if it's the problem but 2.0.15 isn't made to work with php 7.2 .... try lowering it to 7.1 and see if there's any issues.... i'm sure it's something else but just thought i'd mention it :)
i mean it does kind of work i had it running on 7.2 but if you check your error log you'll see a bunch of depressiated errors

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 73,111
Re: IPv6 inet_aton database error on Subs.php
« Reply #2 on: October 06, 2019, 12:58:14 PM »
Think the issue is more that 2.0 has no support for IPv6.
No good deed goes unpunished
All helpful urges should be circumvented

Offline An_dz

  • Newbie
  • *
  • Posts: 4
Re: IPv6 inet_aton database error on Subs.php
« Reply #3 on: October 06, 2019, 01:06:50 PM »
The PHP version was not the problem as I expected, but you never know.

Think the issue is more that 2.0 has no support for IPv6.
Yet I have no problems here, but I do on our forums.

Offline Shambles

  • SMF Hero
  • ******
  • Posts: 5,544
  • Gender: Male
    • i30 Owners Club
Re: IPv6 inet_aton database error on Subs.php
« Reply #4 on: October 06, 2019, 01:28:26 PM »

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 73,111
Re: IPv6 inet_aton database error on Subs.php
« Reply #5 on: October 06, 2019, 02:04:58 PM »
The PHP version was not the problem as I expected, but you never know.

Think the issue is more that 2.0 has no support for IPv6.
Yet I have no problems here, but I do on our forums.

This forum doesn’t support IPv6 either but I’ll bet the handling is a bit different by way of the networking stack on the servers here.

Also do you have a reverse proxy (e.g. CloudFlare) involved? The proxied IP might not be subject to the same “nuke it” rule the normal IP would be.
No good deed goes unpunished
All helpful urges should be circumvented

Offline An_dz

  • Newbie
  • *
  • Posts: 4
Re: IPv6 inet_aton database error on Subs.php
« Reply #6 on: October 06, 2019, 02:23:44 PM »
Think the issue is more that 2.0 has no support for IPv6.
Yet I have no problems here, but I do on our forums.

This forum doesn’t support IPv6 either but I’ll bet the handling is a bit different by way of the networking stack on the servers here.

Also do you have a reverse proxy (e.g. CloudFlare) involved? The proxied IP might not be subject to the same “nuke it” rule the normal IP would be.
No reverse proxy. But that's probably the problem, though I don't think I can change that nor can I convince the server admin to do so.

Could give this mod a whirl

https://custom.simplemachines.org/mods/index.php?mod=3051
It's failing to install but it looks like it's just a single line.

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 59,513
  • Gender: Male
    • Kindred-999 on GitHub
Re: IPv6 inet_aton database error on Subs.php
« Reply #7 on: October 09, 2019, 07:23:48 AM »
So manually update that failed line and finish installing the mod.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Offline An_dz

  • Newbie
  • *
  • Posts: 4
Re: IPv6 inet_aton database error on Subs.php
« Reply #8 on: October 09, 2019, 05:58:28 PM »
Yes, I did try doing it but it ended up being a can of worms. Many other errors popped and I don't have the time to work on it.