Skip to content

Commit

Permalink
Making sure there's something to validate against in fullTLDValidatio…
Browse files Browse the repository at this point in the history
…n; otherwise it'd always return false if user does not provide an specific TLD option

git-svn-id: http://svn.php.net/repository/pear/packages/Validate/trunk@309843 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
amir committed Mar 30, 2011
1 parent ffbd4eb commit 0dfa377
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Validate.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,10 @@ function _fullTLDValidation($email, $options)
if(!empty($options["VALIDATE_GTLD_EMAILS"])) array_push($validate, 'gtld');
if(!empty($options["VALIDATE_CCTLD_EMAILS"])) array_push($validate, 'cctld');

if (count($validate) === 0) {
array_push($validate, 'itld', 'gtld', 'cctld');
}

$self = new Validate;

$toValidate = array();
Expand Down
24 changes: 24 additions & 0 deletions tests/bug17279.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--TEST--
Validate::email
--FILE--
<?php
require_once dirname(dirname(__FILE__)) . '/Validate.php';
var_dump(Validate::email(
'afanstudio@gmail.com',
array(
'fullTLDValidation' => true,
'use_rfc822' => true,
'VALIDATE_CCTLD_EMAILS' => true
)
));
var_dump(Validate::email(
'afanstudio@gmail.com',
array(
'fullTLDValidation' => true,
'use_rfc822' => true,
)
));
?>
--EXPECT--
bool(false)
bool(true)

0 comments on commit 0dfa377

Please sign in to comment.