inet_pton(): Argument #1 ($ip) must not contain any null bytes src/XF/Util/Ip.php:14

M@rc

Well-known member
Affected version
2.3.7
Server Info:
PHP 8.3.29
10.6.24-MariaDB


Tested on my test forum with no addons.

Steps to reproduce:
  1. Enable Writing before registering.
  2. From a logged out account, write a reply and hit Post Reply.
  3. Click the Login button.
register.webp

The screen will return the error:
A server error occurred. Please try again later.

The server error log will have:

Code:
ValueError: inet_pton(): Argument #1 ($ip) must not contain any null bytes src/XF/Util/Ip.php:14
Generated by: Unknown account Jan 16, 2026 at 9:58 PM

Stack trace
#0 src/XF/Util/Ip.php(14): inet_pton([invalid])
#1 src/XF/Entity/Ip.php(25): XF\Util\Ip::stringToBinary([invalid], false)
#2 src/XF/Mvc/Entity/Entity.php(842): XF\Entity\Ip->verifyIp([invalid], 'ip', 6, Array)
#3 src/XF/Mvc/Entity/Entity.php(683): XF\Mvc\Entity\Entity->_verifyValueCustom([invalid], 'ip', 6, Array)
#4 src/XF/Mvc/Entity/Entity.php(618): XF\Mvc\Entity\Entity->set('ip', [invalid])
#5 src/XF/Repository/IpRepository.php(29): XF\Mvc\Entity\Entity->__set('ip', [invalid])
#6 src/XF/Service/Post/PreparerService.php(254): XF\Repository\IpRepository->logIp(1, [invalid], 'post', 97)
#7 src/XF/Service/Post/PreparerService.php(199): XF\Service\Post\PreparerService->writeIpLog([invalid])
#8 src/XF/Service/Thread/ReplierService.php(226): XF\Service\Post\PreparerService->afterInsert()
#9 src/XF/Service/ValidateAndSavableTrait.php(42): XF\Service\Thread\ReplierService->_save()
#10 src/XF/PreRegAction/Thread/Reply.php(47): XF\Service\Thread\ReplierService->save()
#11 src/XF/PreRegAction/AbstractHandler.php(132): XF\PreRegAction\Thread\Reply->executeAction(Object(XF\Entity\PreRegAction), Object(XFES\XF\Entity\Thread), Object(XF\Entity\User))
#12 src/XF.php(906): XF\PreRegAction\AbstractHandler->XF\PreRegAction\{closure}()
#13 src/XF/PreRegAction/AbstractHandler.php(125): XF::asVisitor(Object(XF\Entity\User), Object(Closure))
#14 src/XF/Repository/PreRegActionRepository.php(96): XF\PreRegAction\AbstractHandler->completeAction(Object(XF\Entity\PreRegAction), Object(XF\Entity\User))
#15 src/XF/Repository/PreRegActionRepository.php(126): XF\Repository\PreRegActionRepository->completeUserAction(Object(XF\Entity\User), NULL)
#16 src/XF/ControllerPlugin/LoginPlugin.php(198): XF\Repository\PreRegActionRepository->completeUserActionIfPossible(Object(XF\Entity\User), NULL)
#17 src/XF/Pub/Controller/LoginController.php(164): XF\ControllerPlugin\LoginPlugin->completeLogin(Object(XF\Entity\User), true)
#18 src/XF/Mvc/Dispatcher.php(362): XF\Pub\Controller\LoginController->actionLogin(Object(XF\Mvc\ParameterBag))
#19 src/XF/Mvc/Dispatcher.php(264): XF\Mvc\Dispatcher->dispatchClass('XF:Login', 'Login', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\LoginController), NULL)
#20 src/XF/Mvc/Dispatcher.php(121): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\LoginController), NULL)
#21 src/XF/Mvc/Dispatcher.php(63): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#22 src/XF/App.php(2824): XF\Mvc\Dispatcher->run()
#23 src/XF.php(806): XF\App->run()
#24 index.php(23): XF::runApp('XF\\Pub\\App')
#25 {main}

Request state
array(4) {
  ["url"] => string(16) "/dev/login/login"
  ["referrer"] => string(35) "https://domain.com/dev/register/"
  ["_GET"] => array(1) {
    ["/dev/login/login"] => string(0) ""
  }
  ["_POST"] => array(5) {
    ["_xfToken"] => string(8) "********"
    ["login"] => string(4) "Marc"
    ["password"] => string(8) "********"
    ["remember"] => string(1) "1"
    ["_xfRedirect"] => string(57) "https://domain.com/dev/threads/this-is-a-test.1/page-3"
  }
}
 
Back
Top Bottom