Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
678cf342
Commit
678cf342
authored
Sep 06, 2019
by
pupi1985
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix mismatch between Q2A and PHPMailer email validation algorithm
parent
7ed3f6a0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
2 deletions
+4
-2
emails.php
qa-include/app/emails.php
+1
-0
string.php
qa-include/util/string.php
+1
-1
UtilStringTest.php
qa-tests/UtilStringTest.php
+2
-1
No files found.
qa-include/app/emails.php
View file @
678cf342
...
...
@@ -135,6 +135,7 @@ function qa_send_email($params)
require_once
QA_INCLUDE_DIR
.
'vendor/PHPMailer/PHPMailerAutoload.php'
;
PHPMailer
::
$validator
=
'php'
;
$mailer
=
new
PHPMailer
();
$mailer
->
CharSet
=
'utf-8'
;
...
...
qa-include/util/string.php
View file @
678cf342
...
...
@@ -736,7 +736,7 @@ function qa_email_validate($email)
{
if
(
qa_to_override
(
__FUNCTION__
))
{
$args
=
func_get_args
();
return
qa_call_override
(
__FUNCTION__
,
$args
);
}
return
preg_match
(
"/^[\-\!\#
\$
\%\&\'\*\+\/\=\?\_\`\{\|\}\~a-zA-Z0-9\.\^]+\@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\.\-]+$/"
,
$email
)
===
1
;
return
(
bool
)
filter_var
(
$email
,
FILTER_VALIDATE_EMAIL
)
;
}
...
...
qa-tests/UtilStringTest.php
View file @
678cf342
...
...
@@ -126,13 +126,14 @@ class UtilStringTest extends PHPUnit_Framework_TestCase
$goodEmails
=
array
(
'hello@example.com'
,
'q.a@question2answer.org'
,
'example@newdomain.app'
'example@newdomain.app'
,
);
$badEmails
=
array
(
'nobody@nowhere'
,
'pokémon@example.com'
,
'email @ with spaces'
,
'some random string'
,
'dotbeforeat.@email.com'
,
);
foreach
(
$goodEmails
as
$email
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment