Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
818d1d3d
Commit
818d1d3d
authored
Jul 15, 2015
by
Alex Pott
Browse files
Issue
#2488960
by cilefen, joshi.rohit100, naveenvalecha: Upgrade egulias/EmailValidator to 1.2.9
parent
81658d5c
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
core/composer.lock
View file @
818d1d3d
...
...
@@ -686,29 +686,30 @@
},
{
"name": "egulias/email-validator",
"version": "1.2.
5
",
"version": "1.2.
9
",
"source": {
"type": "git",
"url": "https://github.com/egulias/EmailValidator.git",
"reference": "
518f80a0ff7c1a35780e7702f4262c8c6f2b807f
"
"reference": "
af864423f50ea59f96c87bb1eae147a70bcf67a1
"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/
518f80a0ff7c1a35780e7702f4262c8c6f2b807f
",
"reference": "
518f80a0ff7c1a35780e7702f4262c8c6f2b807f
",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/
af864423f50ea59f96c87bb1eae147a70bcf67a1
",
"reference": "
af864423f50ea59f96c87bb1eae147a70bcf67a1
",
"shasum": ""
},
"require": {
"doctrine/lexer": "~1.0",
"doctrine/lexer": "~1.0
,>=1.0.1
",
"php": ">= 5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.4",
"satooshi/php-coveralls": "dev-master"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "
1.3
.x-dev"
"dev-master": "
2.0
.x-dev"
}
},
"autoload": {
...
...
@@ -729,10 +730,12 @@
"homepage": "https://github.com/egulias/EmailValidator",
"keywords": [
"email",
"emailvalidation",
"emailvalidator",
"validation",
"validator"
],
"time": "201
4-11-06 08:59:44
"
"time": "201
5-06-22 21:07:51
"
},
{
"name": "fabpot/goutte",
...
...
core/vendor/composer/installed.json
View file @
818d1d3d
...
...
@@ -676,58 +676,6 @@
"routing"
]
},
{
"name"
:
"egulias/email-validator"
,
"version"
:
"1.2.5"
,
"version_normalized"
:
"1.2.5.0"
,
"source"
:
{
"type"
:
"git"
,
"url"
:
"https://github.com/egulias/EmailValidator.git"
,
"reference"
:
"518f80a0ff7c1a35780e7702f4262c8c6f2b807f"
},
"dist"
:
{
"type"
:
"zip"
,
"url"
:
"https://api.github.com/repos/egulias/EmailValidator/zipball/518f80a0ff7c1a35780e7702f4262c8c6f2b807f"
,
"reference"
:
"518f80a0ff7c1a35780e7702f4262c8c6f2b807f"
,
"shasum"
:
""
},
"require"
:
{
"doctrine/lexer"
:
"~1.0"
,
"php"
:
">= 5.3.3"
},
"require-dev"
:
{
"satooshi/php-coveralls"
:
"dev-master"
},
"time"
:
"2014-11-06 08:59:44"
,
"type"
:
"library"
,
"extra"
:
{
"branch-alias"
:
{
"dev-master"
:
"1.3.x-dev"
}
},
"installation-source"
:
"dist"
,
"autoload"
:
{
"psr-0"
:
{
"Egulias\\"
:
"src/"
}
},
"notification-url"
:
"https://packagist.org/downloads/"
,
"license"
:
[
"MIT"
],
"authors"
:
[
{
"name"
:
"Eduardo Gulias Davis"
}
],
"description"
:
"A library for validating emails"
,
"homepage"
:
"https://github.com/egulias/EmailValidator"
,
"keywords"
:
[
"email"
,
"validation"
,
"validator"
]
},
{
"name"
:
"easyrdf/easyrdf"
,
"version"
:
"0.9.0"
,
...
...
@@ -3558,5 +3506,60 @@
],
"description"
:
"Symfony BrowserKit Component"
,
"homepage"
:
"https://symfony.com"
},
{
"name"
:
"egulias/email-validator"
,
"version"
:
"1.2.9"
,
"version_normalized"
:
"1.2.9.0"
,
"source"
:
{
"type"
:
"git"
,
"url"
:
"https://github.com/egulias/EmailValidator.git"
,
"reference"
:
"af864423f50ea59f96c87bb1eae147a70bcf67a1"
},
"dist"
:
{
"type"
:
"zip"
,
"url"
:
"https://api.github.com/repos/egulias/EmailValidator/zipball/af864423f50ea59f96c87bb1eae147a70bcf67a1"
,
"reference"
:
"af864423f50ea59f96c87bb1eae147a70bcf67a1"
,
"shasum"
:
""
},
"require"
:
{
"doctrine/lexer"
:
"~1.0,>=1.0.1"
,
"php"
:
">= 5.3.3"
},
"require-dev"
:
{
"phpunit/phpunit"
:
"~4.4"
,
"satooshi/php-coveralls"
:
"dev-master"
},
"time"
:
"2015-06-22 21:07:51"
,
"type"
:
"library"
,
"extra"
:
{
"branch-alias"
:
{
"dev-master"
:
"2.0.x-dev"
}
},
"installation-source"
:
"dist"
,
"autoload"
:
{
"psr-0"
:
{
"Egulias\\"
:
"src/"
}
},
"notification-url"
:
"https://packagist.org/downloads/"
,
"license"
:
[
"MIT"
],
"authors"
:
[
{
"name"
:
"Eduardo Gulias Davis"
}
],
"description"
:
"A library for validating emails"
,
"homepage"
:
"https://github.com/egulias/EmailValidator"
,
"keywords"
:
[
"email"
,
"emailvalidation"
,
"emailvalidator"
,
"validation"
,
"validator"
]
}
]
core/vendor/egulias/email-validator/.gitignore
0 → 100644
View file @
818d1d3d
report/
vendor/
core/vendor/egulias/email-validator/.travis.yml
View file @
818d1d3d
sudo
:
false
language
:
php
php
:
...
...
@@ -5,11 +7,25 @@ php:
-
5.4
-
5.5
-
5.6
-
7.0
-
hhvm
before_script
:
-
wget http://getcomposer.org/composer.phar
-
php composer.phar install --dev --no-interaction
env
:
global
:
-
deps=no
matrix
:
fast_finish
:
true
include
:
-
php
:
5.3
env
:
deps=low
-
php
:
5.6
env
:
deps=high
install
:
-
if [ "$deps" = "no" ]; then composer install; fi
-
if [ "$deps" = "low" ]; then composer update --prefer-lowest; fi
-
if [ "$deps" = "high" ]; then composer update; fi
script
:
-
mkdir -p build/logs
...
...
core/vendor/egulias/email-validator/README.md
View file @
818d1d3d
EmailValidator [](https://travis-ci.org/egulias/EmailValidator) [](https://coveralls.io/r/egulias/EmailValidator?branch=master) [](https://insight.sensiolabs.com/projects/22ba6692-9c02-42e5-a65d-1c5696bfffc6)[](https://scrutinizer-ci.com/g/egulias/EmailValidator/?branch=master)
#EmailValidator
[](https://travis-ci.org/egulias/EmailValidator) [](https://coveralls.io/r/egulias/EmailValidator?branch=master) [](https://scrutinizer-ci.com/g/egulias/EmailValidator/?branch=master) [](https://insight.sensiolabs.com/projects/22ba6692-9c02-42e5-a65d-1c5696bfffc6)
=============================
With the help of

##Installation##
Run the command below to install via Composer
...
...
core/vendor/egulias/email-validator/composer.json
View file @
818d1d3d
...
...
@@ -3,22 +3,23 @@
"description"
:
"A library for validating emails"
,
"homepage"
:
"https://github.com/egulias/EmailValidator"
,
"type"
:
"Library"
,
"keywords"
:
[
"email"
,
"validation"
,
"validator"
],
"keywords"
:
[
"email"
,
"validation"
,
"validator"
,
"emailvalidation"
,
"emailvalidator"
],
"license"
:
"MIT"
,
"authors"
:
[
{
"name"
:
"Eduardo Gulias Davis"
}
],
"extra"
:
{
"branch-alias"
:
{
"dev-master"
:
"
1.3
.x-dev"
"dev-master"
:
"
2.0
.x-dev"
}
},
"require"
:
{
"php"
:
">= 5.3.3"
,
"doctrine/lexer"
:
"~1.0"
"doctrine/lexer"
:
"~1.0
,>=1.0.1
"
},
"require-dev"
:
{
"satooshi/php-coveralls"
:
"dev-master"
"satooshi/php-coveralls"
:
"dev-master"
,
"phpunit/phpunit"
:
"~4.4"
},
"autoload"
:
{
"psr-0"
:
{
...
...
core/vendor/egulias/email-validator/composer.lock
View file @
818d1d3d
This diff is collapsed.
Click to expand it.
core/vendor/egulias/email-validator/documentation/O
h
ter.md
→
core/vendor/egulias/email-validator/documentation/Ot
h
er.md
View file @
818d1d3d
File moved
core/vendor/egulias/email-validator/src/Egulias/EmailValidator/EmailLexer.php
View file @
818d1d3d
...
...
@@ -75,8 +75,6 @@ class EmailLexer extends AbstractLexer
'\0'
=>
self
::
C_NUL
,
);
protected
$invalidASCII
=
array
(
226
=>
1
,);
protected
$hasInvalidTokens
=
false
;
protected
$previous
;
...
...
@@ -138,12 +136,12 @@ public function moveNext()
protected
function
getCatchablePatterns
()
{
return
array
(
'[a-zA-Z_]+[46]?'
,
'[a-zA-Z_]+[46]?'
,
//ASCII and domain literal
'[^\x00-\x7F]'
,
//UTF-8
'[0-9]+'
,
'\r\n'
,
'::'
,
'\s+'
,
'[\x10-\x1F]+'
,
'\s+?'
,
'.'
,
);
}
...
...
@@ -155,7 +153,7 @@ protected function getCatchablePatterns()
*/
protected
function
getNonCatchablePatterns
()
{
return
array
(
'[\x
7f
-\xff]+'
);
return
array
(
'[\x
A0
-\xff]+'
);
}
/**
...
...
@@ -167,16 +165,15 @@ protected function getNonCatchablePatterns()
*/
protected
function
getType
(
&
$value
)
{
if
(
$this
->
isNullType
(
$value
))
{
return
self
::
C_NUL
;
}
if
(
isset
(
$this
->
charValue
[
$value
]
))
{
if
(
$this
->
isValid
(
$value
))
{
return
$this
->
charValue
[
$value
];
}
if
(
$this
->
isInvalid
(
$value
))
{
if
(
$this
->
is
UTF8
Invalid
(
$value
))
{
$this
->
hasInvalidTokens
=
true
;
return
self
::
INVALID
;
}
...
...
@@ -184,8 +181,18 @@ protected function getType(&$value)
return
self
::
GENERIC
;
}
protected
function
isValid
(
$value
)
{
if
(
isset
(
$this
->
charValue
[
$value
]))
{
return
true
;
}
return
false
;
}
/**
* @param string $value
* @param $value
* @return bool
*/
protected
function
isNullType
(
$value
)
{
...
...
@@ -197,18 +204,20 @@ protected function isNullType($value)
}
/**
* @param string $value
* @param $value
* @return bool
*/
protected
function
isInvalid
(
$value
)
protected
function
is
UTF8
Invalid
(
$value
)
{
if
(
preg_match
(
'/[\x10-\x1F]+/'
,
$value
))
{
return
true
;
}
if
(
isset
(
$this
->
invalidASCII
[
ord
(
$value
)]))
{
if
(
preg_match
(
'/\p{Cc}+/u'
,
$value
))
{
return
true
;
}
return
false
;
}
protected
function
getModifiers
()
{
return
'iu'
;
}
}
core/vendor/egulias/email-validator/src/Egulias/EmailValidator/EmailParser.php
View file @
818d1d3d
...
...
@@ -29,7 +29,8 @@ public function __construct(EmailLexer $lexer)
}
/**
* @param string $str
* @param $str
* @return array
*/
public
function
parse
(
$str
)
{
...
...
@@ -39,15 +40,16 @@ public function parse($str)
throw
new
\
InvalidArgumentException
(
'ERR_NOLOCALPART'
);
}
if
(
$this
->
lexer
->
hasInvalidTokens
())
{
throw
new
\
InvalidArgumentException
(
'ERR_INVALID_ATEXT'
);
}
$this
->
localPartParser
->
parse
(
$str
);
$this
->
domainPartParser
->
parse
(
$str
);
$this
->
setParts
(
$str
);
if
(
$this
->
lexer
->
hasInvalidTokens
())
{
throw
new
\
InvalidArgumentException
(
'ERR_INVALID_ATEXT'
);
}
return
array
(
'local'
=>
$this
->
localPart
,
'domain'
=>
$this
->
domainPart
);
}
...
...
core/vendor/egulias/email-validator/src/Egulias/EmailValidator/Parser/DomainPart.php
View file @
818d1d3d
...
...
@@ -104,6 +104,7 @@ protected function doParseDomainPart()
{
$domain
=
''
;
do
{
$prev
=
$this
->
lexer
->
getPrevious
();
if
(
$this
->
lexer
->
token
[
'type'
]
===
EmailLexer
::
S_SLASH
)
{
...
...
@@ -217,9 +218,6 @@ protected function doParseDomainLiteral()
return
$addressLiteral
;
}
/**
* @param string $addressLiteral
*/
protected
function
checkIPV4Tag
(
$addressLiteral
)
{
$matchesIP
=
array
();
...
...
@@ -245,6 +243,17 @@ protected function checkIPV4Tag($addressLiteral)
protected
function
checkDomainPartExceptions
(
$prev
)
{
$invalidDomainTokens
=
array
(
EmailLexer
::
S_DQUOTE
=>
true
,
EmailLexer
::
S_SEMICOLON
=>
true
,
EmailLexer
::
S_GREATERTHAN
=>
true
,
EmailLexer
::
S_LOWERTHAN
=>
true
,
);
if
(
isset
(
$invalidDomainTokens
[
$this
->
lexer
->
token
[
'type'
]]))
{
throw
new
\
InvalidArgumentException
(
'ERR_EXPECTING_ATEXT'
);
}
if
(
$this
->
lexer
->
token
[
'type'
]
===
EmailLexer
::
S_COMMA
)
{
throw
new
\
InvalidArgumentException
(
'ERR_COMMA_IN_DOMAIN'
);
}
...
...
core/vendor/egulias/email-validator/src/Egulias/EmailValidator/Parser/LocalPart.php
View file @
818d1d3d
...
...
@@ -6,7 +6,6 @@
use
Egulias\EmailValidator\EmailValidator
;
use
\
InvalidArgumentException
;
class
LocalPart
extends
Parser
{
public
function
parse
(
$localPart
)
...
...
core/vendor/egulias/email-validator/tests/egulias/Tests/EmailValidator/EmailLexerTest.php
View file @
818d1d3d
...
...
@@ -26,6 +26,73 @@ public function testLexerTokens($str, $token)
$this
->
assertEquals
(
$token
,
$lexer
->
token
[
'type'
]);
}
public
function
testLexerParsesMultipleSpaces
()
{
$lexer
=
new
EmailLexer
();
$lexer
->
setInput
(
' '
);
$lexer
->
moveNext
();
$lexer
->
moveNext
();
$this
->
assertEquals
(
EmailLexer
::
S_SP
,
$lexer
->
token
[
'type'
]);
$lexer
->
moveNext
();
$this
->
assertEquals
(
EmailLexer
::
S_SP
,
$lexer
->
token
[
'type'
]);
}
/**
* @dataProvider invalidUTF8CharsProvider
*/
public
function
testLexerParsesInvalidUTF8
(
$char
)
{
$lexer
=
new
EmailLexer
();
$lexer
->
setInput
(
$char
);
$lexer
->
moveNext
();
$lexer
->
moveNext
();
$this
->
assertEquals
(
EmailLexer
::
INVALID
,
$lexer
->
token
[
'type'
]);
}
public
function
invalidUTF8CharsProvider
()
{
$chars
=
array
();
for
(
$i
=
0
;
$i
<
0x100
;
++
$i
)
{
$c
=
$this
->
utf8Chr
(
$i
);
if
(
preg_match
(
'/(?=\p{Cc})(?=[^\t\n\n\r])/u'
,
$c
)
&&
!
preg_match
(
'/\x{0000}/u'
,
$c
))
{
$chars
[]
=
array
(
$c
);
}
}
return
$chars
;
}
protected
function
utf8Chr
(
$code_point
)
{
if
(
$code_point
<
0
||
0x10FFFF
<
$code_point
||
(
0xD800
<=
$code_point
&&
$code_point
<=
0xDFFF
))
{
return
''
;
}
if
(
$code_point
<
0x80
)
{
$hex
[
0
]
=
$code_point
;
$ret
=
chr
(
$hex
[
0
]);
}
elseif
(
$code_point
<
0x800
)
{
$hex
[
0
]
=
0x1C0
|
$code_point
>>
6
;
$hex
[
1
]
=
0x80
|
$code_point
&
0x3F
;
$ret
=
chr
(
$hex
[
0
])
.
chr
(
$hex
[
1
]);
}
elseif
(
$code_point
<
0x10000
)
{
$hex
[
0
]
=
0xE0
|
$code_point
>>
12
;
$hex
[
1
]
=
0x80
|
$code_point
>>
6
&
0x3F
;
$hex
[
2
]
=
0x80
|
$code_point
&
0x3F
;
$ret
=
chr
(
$hex
[
0
])
.
chr
(
$hex
[
1
])
.
chr
(
$hex
[
2
]);
}
else
{
$hex
[
0
]
=
0xF0
|
$code_point
>>
18
;
$hex
[
1
]
=
0x80
|
$code_point
>>
12
&
0x3F
;
$hex
[
2
]
=
0x80
|
$code_point
>>
6
&
0x3F
;
$hex
[
3
]
=
0x80
|
$code_point
&
0x3F
;
$ret
=
chr
(
$hex
[
0
])
.
chr
(
$hex
[
1
])
.
chr
(
$hex
[
2
])
.
chr
(
$hex
[
3
]);
}
return
$ret
;
}
public
function
testLexerForTab
()
{
$lexer
=
new
EmailLexer
();
...
...
@@ -36,21 +103,23 @@ public function testLexerForTab()
$this
->
assertEquals
(
EmailLexer
::
S_HTAB
,
$lexer
->
token
[
'type'
]);
}
public
function
testLexer
SearchToken
()
public
function
testLexer
ForUTF8
()
{
$lexer
=
new
EmailLexer
();
$lexer
->
setInput
(
"
foo
\t
bar
"
);
$lexer
->
setInput
(
"
áÇ@bar.com
"
);
$lexer
->
moveNext
();
$this
->
assertTrue
(
$lexer
->
find
(
EmailLexer
::
S_HTAB
));
$lexer
->
moveNext
();
$this
->
assertEquals
(
EmailLexer
::
GENERIC
,
$lexer
->
token
[
'type'
]);
$lexer
->
moveNext
();
$this
->
assertEquals
(
EmailLexer
::
GENERIC
,
$lexer
->
token
[
'type'
]);
}
public
function
testLexer
HasInvalid
Token
s
()
public
function
testLexer
Search
Token
()
{
$lexer
=
new
EmailLexer
();
$lexer
->
setInput
(
chr
(
226
));
$lexer
->
moveNext
();
$lexer
->
setInput
(
"foo
\t
bar"
);
$lexer
->
moveNext
();
$this
->
assertTrue
(
$lexer
->
hasInvalidTokens
(
));
$this
->
assertTrue
(
$lexer
->
find
(
EmailLexer
::
S_HTAB
));
}
public
function
getTokens
()
...
...
@@ -85,7 +154,7 @@ public function getTokens()
array
(
'}'
,
EmailLexer
::
S_CLOSEQBRACKET
),
array
(
''
,
EmailLexer
::
S_EMPTY
),
array
(
chr
(
31
),
EmailLexer
::
INVALID
),
array
(
chr
(
226
),
EmailLexer
::
INVALID
),
array
(
chr
(
226
),
EmailLexer
::
GENERIC
),
array
(
chr
(
0
),
EmailLexer
::
C_NUL
)
);
}
...
...
core/vendor/egulias/email-validator/tests/egulias/Tests/EmailValidator/EmailValidatorTest.php
View file @
818d1d3d
...
...
@@ -26,9 +26,18 @@ public function testValidEmails($email)
$this
->
assertTrue
(
$this
->
validator
->
isValid
(
$email
));
}
public
function
testInvalidUTF8Email
()
{
$validator
=
new
EmailValidator
;
$email
=
"
\x80\x81\x82
@
\x83\x84\x85
.
\x86\x87\x88
"
;
$this
->
assertFalse
(
$validator
->
isValid
(
$email
));
}
public
function
getValidEmails
()
{
return
array
(
array
(
'â@iana.org'
),
array
(
'fabien@symfony.com'
),
array
(
'example@example.co.uk'
),
array
(
'fabien_potencier@example.fr'
),
...
...
@@ -47,6 +56,13 @@ public function getValidEmails()
array
(
'"test\ test"@iana.org'
),
array
(
'""@iana.org'
),
array
(
'"\""@iana.org'
),
array
(
'müller@möller.de'
),
array
(
'test@email*'
),
array
(
'test@email!'
),
array
(
'test@email&'
),
array
(
'test@email^'
),
array
(
'test@email%'
),
array
(
'test@email$'
),
);
}
...
...
@@ -61,7 +77,9 @@ public function testInvalidEmails($email)
public
function
getInvalidEmails
()
{
return
array
(
array
(
'test@example.com test'
),
array
(
'user name@example.com'
),
array
(
'user name@example.com'
),
array
(
'example.@example.co.uk'
),
array
(
'example@example@example.co.uk'
),
array
(
'(test_exampel@example.fr)'
),
...
...
@@ -98,6 +116,13 @@ public function getInvalidEmails()
array
(
'test@iana.org \r\n\r\n'
),
array
(
'test@iana.org \r\n\r\n '
),
array
(
'test@iana/icann.org'
),
array
(
'test@foo;bar.com'
),
array
(
'test;123@foobar.com'
),
array
(
'test@example..com'
),
array
(
'email.email@email."'
),
array
(
'test@email>'
),
array
(
'test@email<'
),
array
(
'test@email{'
),
);