From a28ad6df698b4ef20b6698a1f993019ad25bef25 Mon Sep 17 00:00:00 2001 From: Jean Paul Galea Date: Fri, 17 Jul 2015 21:50:28 +0200 Subject: [PATCH] Refactor. - enable strict comparison for sscanf result. - use single quotes where possible. - styling. --- ykval-common.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ykval-common.php b/ykval-common.php index 68b9254..ee03a49 100644 --- a/ykval-common.php +++ b/ykval-common.php @@ -224,7 +224,7 @@ function KSMdecryptOTP($urls, $logger, $curlopts) $urls = array($urls); } - $response = retrieveURLasync("YK-KSM", $urls, $logger, $ans_req=1, $match="^OK", $returl=False, $timeout=10, $curlopts); + $response = retrieveURLasync('YK-KSM', $urls, $logger, $ans_req=1, $match='^OK', $returl=False, $timeout=10, $curlopts); if (is_array($response)) { @@ -233,10 +233,15 @@ function KSMdecryptOTP($urls, $logger, $curlopts) if ($response) { - $logger->log(LOG_DEBUG, log_format("YK-KSM response: ", $response)); + $logger->log(LOG_DEBUG, log_format('YK-KSM response: ', $response)); } - if (sscanf($response, "OK counter=%04x low=%04x high=%02x use=%02x", $ret["session_counter"], $ret["low"], $ret["high"], $ret["session_use"]) != 4) + if (sscanf($response, + 'OK counter=%04x low=%04x high=%02x use=%02x', + $ret['session_counter'], + $ret['low'], + $ret['high'], + $ret['session_use'] !== 4) { return false; }