1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-06 06:25:04 +02:00

Merge pull request #6705 from rxu/ticket/17383

[ticket/17383] Fix HELO/EHLO error in email messenger on PHP8
This commit is contained in:
Marc Alexander 2024-09-29 19:29:37 +02:00 committed by GitHub
commit 6db142b8ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1418,22 +1418,22 @@ class smtp_class
global $user;
// Here we try to determine the *real* hostname (reverse DNS entry preferrably)
$local_host = $user->host;
if (function_exists('php_uname'))
if (function_exists('php_uname') && !empty($local_host = php_uname('n')))
{
$local_host = php_uname('n');
// Able to resolve name to IP
if (($addr = @gethostbyname($local_host)) !== $local_host)
{
// Able to resolve IP back to name
if (($name = @gethostbyaddr($addr)) !== $addr)
if (!empty($name = @gethostbyaddr($addr)) && $name !== $addr)
{
$local_host = $name;
}
}
}
else
{
$local_host = $user->host;
}
// If we are authenticating through pop-before-smtp, we
// have to login ones before we get authenticated