Bug #10681: Fix for #9698 breaks more than it fixes
| From: | kettler at gmx dot net | Date: | Sat, 05 May 2001 08:40:03 +0000 |
| Subject: | Bug #10681: Fix for #9698 breaks more than it fixes | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-53992@lists.php.net to get a copy of this message | ||
From: kettler@gmx.net
Operating system: Linux
PHP version: 4.0 Latest CVS (05/05/2001)
PHP Bug Type: Network related
Bug description: Fix for #9698 breaks more than it fixes
<?php
$ipaslong = ip2long("208.247.106.187");
print long2ip($ipaslong)."\n";
print bin2hex(pack("N", $ipaslong))."\n";
?>
That script run with PHP 4.0.5 prints:
208.247.106.187
d0f76abb
whereas with the latest CVS version it prints:
127.255.255.255
7fffffff
That makes that function completely unusable for me (and for others probably too). I have another
proposal for fixing bug #9698, and that is implementing %u as a sprintf format specifier to output
unsigned longs instead of signed.
This way he could use the following script for his problem (should go onto the ip2long page then):
<?php
$ip = gethostbyname("www.php.net");
$out = sprintf("http://%u/<br>\n", ip2long($ip));
echo $out;
?>
If that fix would be accepted (and the other fix rolled back), I could add %u to sprintf myself and
post it here.
--
Edit Bug report at: http://bugs.php.net/?id=10681&edit=1