#26667 [Fbk->Opn]: ip2long("") = 0 intstead of -1
ID: 26667
User updated by: ovdspek at liacs dot nl
Reported By: ovdspek at liacs dot nl
-Status: Feedback
+Status: Open
Bug Type: Unknown/Other Function
Operating System: Windows NT 4 SP 6
PHP Version: 4.3.3
New Comment:
D:\Temp>php ..\wte\php\a.php
Content-type: text/html
X-Powered-By: PHP/4.3.5-dev
0
Previous Comments:
------------------------------------------------------------------------
[2003-12-19 07:03:05] derick@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
Okay, then please try the latest version :)
------------------------------------------------------------------------
[2003-12-19 06:53:25] ovdspek at liacs dot nl
I made a mistake, I'm running 4.3.3:
http://62.216.18.38/temp/a.php
http://62.216.18.38/temp/a.phps
http://62.216.18.38/temp/info.php
------------------------------------------------------------------------
[2003-12-19 06:41:47] derick@php.net
hmm, works for me:
derick@kossu:~$ php-4.3dev -r 'echo ip2long(""); '
-1
------------------------------------------------------------------------
[2003-12-19 06:22:34] ovdspek at liacs dot nl
Description:
------------
ip2long returns 0 if the input is an empty string. However, an empty
string is not valid, so it should return -1.
"The function ip2long() generates an IPv4 Internet network address from
its Internet standard format (dotted string) representation. If
ip_address is invalid than -1 is returned. Note that -1 does not
evaluate as FALSE in PHP."
Reproduce code:
---------------
<?php echo ip2long(""); ?>
Expected result:
----------------
-1
Actual result:
--------------
0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26667&edit=1
Thread (6 messages)