Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Applied trim and strtolower to Gravatar email per Gravatar docs: https://en.gravatar.com/site/implement/hash/ #4976

Merged
merged 2 commits into from

4 participants

@PHLAK

Per the Gravatar docs, the provided email address should be trimmed of all preceding and trailing white space and converted to lowercase before being hashed. This PR adds that functionality to the ZF2 Gravatar function.

@Ocramius
Collaborator

@PHLAK tests!

@EvanDotPro
Collaborator

:+1:

@samsonasik samsonasik referenced this pull request from a commit in samsonasik/zf2
@samsonasik samsonasik no new line after <?php open tag
the new line happen after PR #4976 merged
4813755
@Maks3w
Collaborator

@EvanDotPro There is something wrong with the merge commits e702a42 c21cd36. This commits claims to be this PR but the code is from other PR

@EvanDotPro EvanDotPro was assigned
@EvanDotPro EvanDotPro referenced this pull request from a commit
@EvanDotPro EvanDotPro Revert "Merge PHLAK:hotfix/gravatar-trim-strtolower into develop"
This reverts commit c21cd36, reversing
changes made to 3138073.

I mistakingly fetched #4967 instead of #4976.
d7d4193
@EvanDotPro EvanDotPro referenced this pull request from a commit
@EvanDotPro EvanDotPro Revert "Merge PHLAK:hotfix/gravatar-trim-strtolower into master"
This reverts commit e702a42, reversing
changes made to 0a74768.

I mistakingly fetched #4967 instead of #4976.
33db792
@EvanDotPro EvanDotPro referenced this pull request from a commit
@EvanDotPro EvanDotPro Merge PHLAK:hotfix/gravatar-trim-strtolower into master
Pull request #4976

Merge commit 'refs/pull/4976/head' of github.com:zendframework/zf2
0023a96
@EvanDotPro EvanDotPro merged commit 10868ae into zendframework:master
@EvanDotPro
Collaborator

@Maks3w Thanks for pointing that out. Please see my comment here. I had transposed the 6 and the 7 in the PR # when fetching locally to merge, so it merged the wrong PR.

I've reverted and corrected this now, everything should be good.

@gianarb gianarb referenced this pull request from a commit in zendframework/zend-view
@EvanDotPro EvanDotPro Merge PHLAK:hotfix/gravatar-trim-strtolower into develop 28be59d
@gianarb gianarb referenced this pull request from a commit in zendframework/zend-view
@EvanDotPro EvanDotPro Merge PHLAK:hotfix/gravatar-trim-strtolower into master
Pull request zendframework/zf2#4976

Merge commit 'refs/pull/4976/head' of github.com:zendframework/zf2
e1a1ab3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
2  library/Zend/View/Helper/Gravatar.php
@@ -239,7 +239,7 @@ public function getDefaultImg()
public function setEmail($email)
{
$this->emailIsHashed = (bool) preg_match('/^[A-Za-z0-9]{32}$/', $email);
- $this->email = $email;
+ $this->email = strtolower(trim($email));
return $this;
}
View
7 tests/ZendTest/View/Helper/GravatarTest.php
@@ -274,4 +274,11 @@ public function testInvalidKeyPassedToSetOptionsMethod()
);
$this->helper->__invoke()->setOptions($options);
}
+
+ public function testEmailIsProperlyNormalized()
+ {
+ $this->assertEquals('example@example.com',
+ $this->helper->__invoke('Example@Example.com ')->getEmail()
+ );
+ }
}
Something went wrong with that request. Please try again.