From: phpbugspam at netebb dot com
Operating system: Windows 2000 SP4
PHP version: 5.0.0b2 (beta2)
PHP Bug Type: Scripting Engine problem
Bug description: ip2long() fails if IP begins with a 0 (zero)
Description:
------------
Line 4 (09.0.0.0) fails in the following code.
Fails on both 4.3.4 and 5.0.0b2.
Haven't tried it in *nix.
Thanks,
Ross
Reproduce code:
---------------
<?php
ini_set('html_errors', false);
assert(ip2long('1.0.0.0') == ip2long('01.0.0.0'));
assert(ip2long('9.0.0.0') == ip2long('09.0.0.0'));
echo 'phpversion=',phpversion();
?>
Expected result:
----------------
Nothing.
Actual result:
--------------
$ php -q bug_ip2long.php
Warning: assert(): Assertion failed in
c:\ross\freebeer\www\demo\bug_ip2long.php on line 4
phpversion=4.3.4
$ php -q bug_ip2long.php
Warning: assert(): Assertion failed in
c:\ross\freebeer\www\demo\bug_ip2long.php on line 4
phpversion=5.0.0b2
--
Edit bug report at http://bugs.php.net/?id=26170&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26170&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26170&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26170&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26170&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26170&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=26170&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26170&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26170&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26170&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26170&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26170&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26170&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26170&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26170&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26170&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26170&r=float