@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | // Verify expiration |
| 113 | 113 | if ($cookieData) { |
| 114 | - $expiry = (int)substr($cookieData, 0, 10); |
|
| 114 | + $expiry = (int) substr($cookieData, 0, 10); |
|
| 115 | 115 | $data = substr($cookieData, 10); |
| 116 | 116 | |
| 117 | 117 | if ($expiry > $this->getNow()) { |
@@ -148,11 +148,11 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | // Restore the known good cookie value |
| 150 | 150 | $this->currentCookieData = $this->crypto->encrypt( |
| 151 | - sprintf('%010u', $expiry) . $session_data |
|
| 151 | + sprintf('%010u', $expiry).$session_data |
|
| 152 | 152 | ); |
| 153 | 153 | |
| 154 | 154 | // Respect auto-expire on browser close for the session cookie (in case the cookie lifetime is zero) |
| 155 | - $cookieLifetime = min((int)$params['lifetime'], $lifetime); |
|
| 155 | + $cookieLifetime = min((int) $params['lifetime'], $lifetime); |
|
| 156 | 156 | |
| 157 | 157 | Cookie::set( |
| 158 | 158 | $this->cookie, |
@@ -45,8 +45,8 @@ |
||
| 45 | 45 | protected function getLifetime() |
| 46 | 46 | { |
| 47 | 47 | $params = session_get_cookie_params(); |
| 48 | - $cookieLifetime = (int)$params['lifetime']; |
|
| 49 | - $gcLifetime = (int)ini_get('session.gc_maxlifetime'); |
|
| 48 | + $cookieLifetime = (int) $params['lifetime']; |
|
| 49 | + $gcLifetime = (int) ini_get('session.gc_maxlifetime'); |
|
| 50 | 50 | |
| 51 | 51 | return $cookieLifetime ? min($cookieLifetime, $gcLifetime) : $gcLifetime; |
| 52 | 52 | } |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | $ivlen = openssl_cipher_iv_length($cipher); |
| 85 | 85 | $iv = substr($c, 0, $ivlen); |
| 86 | 86 | $hmac = substr($c, $ivlen, $sha2len = 32); |
| 87 | - $ciphertext_raw = substr($c, $ivlen+$sha2len); |
|
| 87 | + $ciphertext_raw = substr($c, $ivlen + $sha2len); |
|
| 88 | 88 | $cleartext = openssl_decrypt($ciphertext_raw, $cipher, $this->saltedKey, $options = OPENSSL_RAW_DATA, $iv); |
| 89 | 89 | $calcmac = hash_hmac('sha256', $ciphertext_raw, $this->saltedKey, $as_binary = true); |
| 90 | 90 | |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | |
| 19 | 19 | $handler = new OpenSSLCrypto($key, $salt); |
| 20 | 20 | |
| 21 | - for ($i=0; $i<1000; ++$i) { |
|
| 21 | + for ($i = 0; $i < 1000; ++$i) { |
|
| 22 | 22 | $data = random_bytes(1024 * 4); |
| 23 | 23 | |
| 24 | 24 | $this->assertEquals($data, $handler->decrypt($handler->encrypt($data))); |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | |
| 19 | 19 | $handler = new McryptCrypto($key, $salt); |
| 20 | 20 | |
| 21 | - for ($i=0; $i<1000; ++$i) { |
|
| 21 | + for ($i = 0; $i < 1000; ++$i) { |
|
| 22 | 22 | $data = random_bytes(1024 * 4); |
| 23 | 23 | |
| 24 | 24 | $this->assertEquals($data, $handler->decrypt($handler->encrypt($data))); |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | |
| 29 | 29 | public function testDataCodecIntegrity() |
| 30 | 30 | { |
| 31 | - for ($i=0; $i<1000; ++$i) { |
|
| 31 | + for ($i = 0; $i < 1000; ++$i) { |
|
| 32 | 32 | $data = random_bytes(1024 * 4); |
| 33 | 33 | |
| 34 | 34 | $this->assertEquals($data, DatabaseStore::binaryDataJsonDecode(DatabaseStore::binaryDataJsonEncode($data))); |