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


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 http://framework.zend.com/issues/browse/ZF-11239 is good enough to replicate the issue.

PHP 5.3.8 Zend Engine v2.3.0


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.