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 [url]http://bugs.php.net/?id=26170&edit=1[/url]
--
Try a CVS snapshot (php4): [url]http://bugs.php.net/fix.php?id=26170&r=trysnapshot4[/url]
Try a CVS snapshot (php5): [url]http://bugs.php.net/fix.php?id=26170&r=trysnapshot5[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=26170&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=26170&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=26170&r=needtrace[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=26170&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=26170&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=26170&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=26170&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=26170&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=26170&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=26170&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=26170&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=26170&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=26170&r=gnused[/url]
Floating point limitations: [url]http://bugs.php.net/fix.php?id=26170&r=float[/url]