ZF-5186: Zend_Validate_Ip::isValid() doesn't return false for invalid IP addresses after r13098
Description
The addition of IPv6 support to Zend_Validate_IP in r13098 is causing invalid IP addresses to return a warning when calling Zend_Gdata_Validate_Ip::isValid() rather than false as expected.
Test output:
$ phpunit Zend_Validate_IpTest PHPUnit 3.3.1 by Sebastian Bergmann. E..EE. Time: 0 seconds There were 3 errors: 1) testBasic(Zend_Validate_IpTest) inet_pton(): Unrecognized address 0.0.0.256 .../library/Zend/Validate/Ip.php:62 .../library/Zend/Validate/Ip.php:62 2) testInvalidIpForZF4809(Zend_Validate_IpTest) inet_pton(): Unrecognized address 1.2.333 .../library/Zend/Validate/Ip.php:62 .../library/Zend/Validate/Ip.php:62 3) testInvalidIpForZF3435(Zend_Validate_IpTest) inet_pton(): Unrecognized address 192.168.0.2 adfs .../library/Zend/Validate/Ip.php:62 .../library/Zend/Validate/Ip.php:62 FAILURES! Tests: 6, Assertions: 6, Errors: 3.
Comments
Posted by Trevor Johns (tjohns) on 2008-12-08T14:38:24.000+0000
Resolved for trunk in r13104.
Posted by Trevor Johns (tjohns) on 2008-12-11T18:26:51.000+0000
Marking as fixed for next minor release.
Posted by Trevor Johns (tjohns) on 2008-12-15T15:20:04.000+0000
Merged from trunk into release-1.7 branch as r13289.
Marking as fixed for next mini release.
Posted by Louis-Philippe Huberdeau (lphuberdeau) on 2009-02-04T18:36:06.000+0000
Using /svn/framework/standard/branches/release-1.7/ @ r13981, I am getting warnings with inet_pton.
I don't know how closely related it is to this issue, but it seems like hostname validation first verifies if the hostname is an IP, and while it returns false, a warning still goes off. There is some error suppressing in Zend_Validate_Ip...
inet_pton() [function.inet-pton]: Unrecognized address [...]
Posted by Trevor Johns (tjohns) on 2009-02-04T20:16:48.000+0000
Louis, Can you open a new issue, and mention this issue's ID in the description? I'd rather not re-open this bug, since I'm not positive that this is the same issue, and we already pushed out a fix for this issue in a past release.
Posted by Madhava Jay (samuraixp) on 2009-03-12T21:41:47.000+0000
Hey Louis I am having the same issue, I get a PHP WARNING when ever I use the Email Validate function and the error is from inet_pton
Error Number: 2
Error Type: PHP WARNING
Error String: inet_pton() [function.inet-pton]: Unrecognized address domain.com.au
Error File: /usr/local/www/data/project.com.au/library/Zend/Validate/Ip.php
Error Line: 62
0 errorHandler(2, inet_pton() [function.inet-pton]: Unrecognized address kintek.com.au, /usr/local/www/data/project.com.au/library/Zend/Validate/Ip.php, 62, Array ([value] => domain.com.au,[valueString] => domain.com.au))
Obviously it shouldnt be checking if a domain is an IP right? and if so why cause this error? This is 1.7.5 im using.
Is there an official bug report for this somewhere?