1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 14:00:56 +01:00

strncmp is better than strpos

Summary: no need to get all O(N) up in this when we can do constant time of "8"

Test Plan: arc lint

Reviewers: vrana, epriestley

Reviewed By: vrana

CC: aran, Korvin

Maniphest Tasks: T891

Differential Revision: https://secure.phabricator.com/D3271
This commit is contained in:
Bob Trahan 2012-08-13 18:02:28 -07:00
parent 6ce39db6ca
commit f748a47237

View file

@ -105,7 +105,7 @@ extends PhabricatorOAuthProvider {
public function setUserData($data) {
// legacy conditionally strip shield. see D3265 for discussion.
if (strpos($data, 'for(;;);') === 0) {
if (strncmp($data, 'for(;;);', 8) === 0) {
$data = substr($data, 8);
}
$data = idx(json_decode($data, true), 'result');