ZF-11952: Zend_Validate_Hostname should instantiate Zend_Validate_Ip or completely ignore when not set

Issue Type: Sub-task Created: 2011-12-20T14:13:28.000+0000 Last Updated: 2012-02-26T07:44:59.000+0000 Status: Closed Fix version(s): Reporter: Luís Nunes (luiscnunes) Assignee: Adam Lundrigan (adamlundrigan) Tags: - Zend_Validate

Related issues: Attachments:


Currently Zend_Validate_Hostname does several calls on $this->_options['ip'] - whether set or not, resulting in fatal error "call to a member function on a non-object". In my opinion, a fatal error should always be prevented, so either set a default ip validator or ignore all portions where one would be needed.

The bug described at is good enough to replicate the issue.

PHP 5.3.8 Zend Engine v2.3.0


Posted by Adam Lundrigan (adamlundrigan) on 2012-02-26T07:44:59.000+0000

Could not reproduce against trunk.

The ip option will always be set to a valid IP validator. When the Hostname validator is instantiated, the supplied options ($options) are merged with the default set of options ($this->_options) and passed to setOptions. Due to the fact that $this->_options has an ip key defined (as null), setOptions will call setIpValidator and a new instance of Zend_Hostname_Ip will be instantiated.

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.