PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Validate » Validate » Bug #6930

Email validation via ::multiple always checks domain

Details

Submitted2006-02-25 01:18 UTC
Fromnhyde at bigdrift dot com
Assignedpajoye
StatusClosed
PackageValidate
PHP Version4.4.1
OSLinux
Roadmaps(Not assigned)

Comments

[2006-02-25 01:18 UTC] nhyde at bigdrift dot com

Description:
------------
When running Validate::multiple on an email type, if a parameter is passed in the options, a domain check will be performed, regardless of the value of the first parameter.

A patchfile, xdebug 2beta5 cachegrind output for before and after the patch and an updated phpt test is available in http://www.bigdrift.com/pear/validate/

Test script:
---------------
<?php
require 'Validate.php';
$aValues = array('emailAddress' => 'support@honesttowing.com');
$aOptions = array('emailAddress' => array('type'=>'email'
,array('check_domain'=>false)));
$valid = Validate::multiple($aValues,$aOptions);
$multiWithoutDomain = $valid['emailAddress'];
$aOptions = array('emailAddress' => array('type'=>'email',array('check_domain'=>true)));
$valid = Validate::multiple($aValues,$aOptions);
$multiWithDomain = $valid['emailAddress'];
$withoutDomain = Validate::email($aValues['emailAddress'],false);

print 'Multiple, without check_domain: '.$multiWithoutDomain."\n";
print 'Multiple, with check_domain: '.$multiWithDomain."\n";
print 'Direct, without check_domain: '.$withoutDomain."\n";
?>

Expected result:
----------------
Multiple without check_domain would return true, as a direct call to email, with check_domain = false;

Multiple, without check_domain: 1
Multiple, with check_domain:
Direct, without check_domain: 1