ZF-2420: Zend_Validate_Ip doesn't recognize 0.0.0.0 as a valid ip..

Description

line 62 of Zend_Validate_Ip (release-1.0.3) is "if (!ip2long($valueString)) {" shouldn't this be "if (false === ip2long($valueString)) {" since php versions >= 5.0.3 return boolean false if a string given is not an ip.

I found this from a problem with 0.0.0.0 returning 0 from ip2long and breaking my Zend_Filter_Input validation chain

Comments

IP of 0.0.0.0 is in fact a valid IP address (although reserved). Fixed. Thanks, Jordan.

As a side note: I have refactored an accompanying test for more readability.

Hostname tests should also be refactored in the future because it's really hard to tell which test have failed when you iterate the array:


PHPUnit 3.0.6 by Sebastian Bergmann.

.........................................
.F.......................................
..

Time: 00:00

There was 1 failure:

1) testBasic(Zend_Validate_HostnameTest)
Failed asserting that  is equal to .
/home/martel/Projects/zend-framework/tests/Zend/Validate/HostnameTest.php:81
/home/martel/Projects/zend-framework/tests/Zend/Validate/AllTests.php:177
/home/martel/Projects/zend-framework/tests/Zend/Validate/AllTests.php:214

FAILURES!
Tests: 84, Failures: 1.