Skip to content
Browse files

Making sure there's something to validate against in fullTLDValidatio…

…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...
1 parent ffbd4eb commit 0dfa37784b03f2042bde27d2f38a0c72c82fe4e9 @amir amir committed
Showing with 28 additions and 0 deletions.
  1. +4 −0 Validate.php
  2. +24 −0 tests/bug17279.phpt
View
4 Validate.php
@@ -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();
View
24 tests/bug17279.phpt
@@ -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.
Something went wrong with that request. Please try again.