Skip to main content
Topic: host: '' is not a legal name (unexpected end of input) (Read 5216 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

Re: host: '' is not a legal name (unexpected end of input)

Reply #15
That's fine, but is ip2 being blank the design or a hint there is another bug?  What is the point of ip2?

Re: host: '' is not a legal name (unexpected end of input)

Reply #16
That's something I was trying to understand as well.
In theory it should not be empty, but apparently it is...
And I would call that a bug, yes.
And it affects SMF 2.1 as well, but not 2.0 so yes it's a bug.

It may be this:
Code: [Select]
		// Some final checking.
if (preg_match('~^((([1]?\d)?\d|2[0-4]\d|25[0-5])\.){3}(([1]?\d)?\d|2[0-4]\d|25[0-5])$~', $this->_ban_ip) === 0 || !isValidIPv6($this->_ban_ip))
$this->_ban_ip = '';
In the past it was just:
Code: [Select]
		// Some final checking.
if (preg_match('~^((([1]?\d)?\d|2[0-4]\d|25[0-5])\.){3}(([1]?\d)?\d|2[0-4]\d|25[0-5])$~', $this->_ban_ip) === 0)
$this->_ban_ip = '';
And it make sense that now is overwriting all the IPs because the regexp in isValidIPv6 doesn't match an IPv4 address.

So the code should be:
Code: [Select]
		// Some final checking.
if (preg_match('~^((([1]?\d)?\d|2[0-4]\d|25[0-5])\.){3}(([1]?\d)?\d|2[0-4]\d|25[0-5])$~', $this->_ban_ip) === 0 && !isValidIPv6($this->_ban_ip))
$this->_ban_ip = '';


I was thinking also to change the ban_ip method to:
Code: [Select]
	public function ban_ip()
{
return !empty($this->_ban_ip) ? $this->_ban_ip : $this->client_ip();
}
Does it make sense?
Bugs creator.
Features destroyer.
Template killer.