ZF-5186: Zend_Validate_Ip::isValid() doesn't return false for invalid IP addresses after r13098

Issue Type: Bug Created: 2008-12-08T14:14:19.000+0000 Last Updated: 2009-03-12T21:41:59.000+0000 Status: Resolved Fix version(s): - 1.7.2 (23/Dec/08)

Reporter: Trevor Johns (tjohns) Assignee: Trevor Johns (tjohns) Tags: - Zend_Validate

Related issues: - ZF-2694



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:

<pre class="literal">$ phpunit Zend_Validate_IpTest
PHPUnit 3.3.1 by Sebastian Bergmann.


Time: 0 seconds

There were 3 errors:

1) testBasic(Zend_Validate_IpTest)
inet_pton(): Unrecognized address

2) testInvalidIpForZF4809(Zend_Validate_IpTest)
inet_pton(): Unrecognized address 1.2.333

3) testInvalidIpForZF3435(Zend_Validate_IpTest)
inet_pton(): Unrecognized address adfs

Tests: 6, Assertions: 6, Errors: 3.


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 [...]

        [1] => Array
                [file] => /mnt/local/home/lphtaskestimation/lib/Zend/Validate/Ip.php
                [line] => 62
                [function] => inet_pton

        [2] => Array
                [file] => /mnt/local/home/lphtaskestimation/lib/Zend/Validate/Hostname.php
                [line] => 284
                [function] => isValid
                [class] => Zend_Validate_Ip

        [3] => Array
                [file] => /mnt/local/home/lphtaskestimation/lib/Zend/Uri/Http.php
                [line] => 448
                [function] => isValid
                [class] => Zend_Validate_Hostname

        [4] => Array
                [file] => /mnt/local/home/lphtaskestimation/lib/Zend/Uri/Http.php
                [line] => 280
                [function] => validateHost
                [class] => Zend_Uri_Http

        [5] => Array
                [file] => /mnt/local/home/lphtaskestimation/lib/Zend/Uri/Http.php
                [line] => 154
                [function] => valid
                [class] => Zend_Uri_Http

        [6] => Array
                [file] => /mnt/local/home/lphtaskestimation/lib/Zend/Uri.php
                [line] => 132
                [function] => __construct
                [class] => Zend_Uri_Http

        [7] => Array
                [file] => /mnt/local/home/lphtaskestimation/lib/Zend/Http/Client.php
                [line] => 257
                [function] => factory
                [class] => Zend_Uri

        [8] => Array
                [file] => /mnt/local/home/lphtaskestimation/lib/Zend/Http/Client.php
                [line] => 243
                [function] => setUri
                [class] => Zend_Http_Client

        [9] => Array
                [file] => /mnt/local/home/lphtaskestimation/lib/Zend/OpenId/Consumer.php
                [line] => 490
                [function] => __construct
                [class] => Zend_Http_Client

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 String: inet_pton() [function.inet-pton]: Unrecognized address

Error File: /usr/local/www/data/

Error Line: 62

0 errorHandler(2, inet_pton() [function.inet-pton]: Unrecognized address, /usr/local/www/data/, 62, Array ([value] =>,[valueString] =>

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?

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.