Recent Topics

1 Oct 13, 2005 05:34    

I'm running 0.9.1 here and have been noticing lines like this in my error log:

[client 202.29.53.5] PHP Notice: Undefined variable: HTTP_SERVER_VARS in /var/www/bikerscum/htsrv/trackback.php on line 56

[client 202.29.53.5] PHP Warning: gethostbyaddr() [<a href='function.gethostbyaddr'>function.gethostbyaddr</a>]: Address is not a valid IPv4 or IPv6 address in /var/www/bikerscum/htsrv/trackback.php on line 57

Yes, I know I don't have 'register_long_arrays' on. That's been handled, hopefully, by switching to $_SERVER and $_GET instead of the older $HTTP_SERVER_VARS and $HTTP_GET_VARS. But that's not the point here. On line 57 of trackback.php there's a call to gethostbyaddr() that's kind of broken. If there's more than one IP it can break. So, based on the info from http://us2.php.net/gethostbyaddr I added the following lines to trackback.php immediately below line 56:

if(strstr($user_ip, ', ')){
$ips = explode(', ', $user_ip);
$user_ip = $ips[0];
}

Does this make sense or am I just being silly?

Pat

2 Nov 16, 2005 01:38

This is actually the last place where HTTP_SERVER_VARS gets used.

The problem with gethostbyaddr() is then probably that $user_ip is empty, not several addresses.

I've fixed it now though with the additional explode by comma.

Thanks for pointing it out.

I'll commit it to CVS (0.9.1 and Phoenix).


Form is loading...