|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-12-19 06:22 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 01:00:02 2025 UTC |
hmm, works for me: derick@kossu:~$ php-4.3dev -r 'echo ip2long(""); ' -1