Passed
Push — vko_fix_build ( f1c349...f93f07 )
by Vitalii
25:51 queued 10:00
created
html/inc/password_compat/password.inc 3 patches
Switch Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -50,47 +50,47 @@  discard block
 block discarded – undo
50 50
             }
51 51
             $resultLength = 0;
52 52
             switch ($algo) {
53
-                case PASSWORD_BCRYPT:
54
-                    $cost = PASSWORD_BCRYPT_DEFAULT_COST;
55
-                    if (isset($options['cost'])) {
56
-                        $cost = (int) $options['cost'];
57
-                        if ($cost < 4 || $cost > 31) {
58
-                            trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING);
59
-                            return null;
60
-                        }
53
+            case PASSWORD_BCRYPT:
54
+                $cost = PASSWORD_BCRYPT_DEFAULT_COST;
55
+                if (isset($options['cost'])) {
56
+                    $cost = (int) $options['cost'];
57
+                    if ($cost < 4 || $cost > 31) {
58
+                        trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING);
59
+                        return null;
61 60
                     }
62
-                    // The length of salt to generate
63
-                    $raw_salt_len = 16;
64
-                    // The length required in the final serialization
65
-                    $required_salt_len = 22;
66
-                    $hash_format = sprintf("$2y$%02d$", $cost);
67
-                    // The expected length of the final crypt() output
68
-                    $resultLength = 60;
69
-                    break;
70
-                default:
71
-                    trigger_error(sprintf("password_hash(): Unknown password hashing algorithm: %s", $algo), E_USER_WARNING);
72
-                    return null;
61
+                }
62
+                // The length of salt to generate
63
+                $raw_salt_len = 16;
64
+                // The length required in the final serialization
65
+                $required_salt_len = 22;
66
+                $hash_format = sprintf("$2y$%02d$", $cost);
67
+                // The expected length of the final crypt() output
68
+                $resultLength = 60;
69
+                break;
70
+            default:
71
+                trigger_error(sprintf("password_hash(): Unknown password hashing algorithm: %s", $algo), E_USER_WARNING);
72
+                return null;
73 73
             }
74 74
             $salt_req_encoding = false;
75 75
             if (isset($options['salt'])) {
76 76
                 switch (gettype($options['salt'])) {
77
-                    case 'NULL':
78
-                    case 'boolean':
79
-                    case 'integer':
80
-                    case 'double':
81
-                    case 'string':
77
+                case 'NULL':
78
+                case 'boolean':
79
+                case 'integer':
80
+                case 'double':
81
+                case 'string':
82
+                    $salt = (string) $options['salt'];
83
+                    break;
84
+                case 'object':
85
+                    if (method_exists($options['salt'], '__tostring')) {
82 86
                         $salt = (string) $options['salt'];
83 87
                         break;
84
-                    case 'object':
85
-                        if (method_exists($options['salt'], '__tostring')) {
86
-                            $salt = (string) $options['salt'];
87
-                            break;
88
-                        }
89
-                    case 'array':
90
-                    case 'resource':
91
-                    default:
92
-                        trigger_error('password_hash(): Non-string salt parameter supplied', E_USER_WARNING);
93
-                        return null;
88
+                    }
89
+                case 'array':
90
+                case 'resource':
91
+                default:
92
+                    trigger_error('password_hash(): Non-string salt parameter supplied', E_USER_WARNING);
93
+                    return null;
94 94
                 }
95 95
                 if (PasswordCompat\binary\_strlen($salt) < $required_salt_len) {
96 96
                     trigger_error(sprintf("password_hash(): Provided salt is too short: %d expecting %d", PasswordCompat\binary\_strlen($salt), $required_salt_len), E_USER_WARNING);
@@ -212,12 +212,12 @@  discard block
 block discarded – undo
212 212
                 return true;
213 213
             }
214 214
             switch ($algo) {
215
-                case PASSWORD_BCRYPT:
216
-                    $cost = isset($options['cost']) ? (int) $options['cost'] : PASSWORD_BCRYPT_DEFAULT_COST;
217
-                    if ($cost !== $info['options']['cost']) {
218
-                        return true;
219
-                    }
220
-                    break;
215
+            case PASSWORD_BCRYPT:
216
+                $cost = isset($options['cost']) ? (int) $options['cost'] : PASSWORD_BCRYPT_DEFAULT_COST;
217
+                if ($cost !== $info['options']['cost']) {
218
+                    return true;
219
+                }
220
+                break;
221 221
             }
222 222
             return false;
223 223
         }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -38,14 +38,14 @@  discard block
 block discarded – undo
38 38
                 return null;
39 39
             }
40 40
             if (is_null($password) || is_int($password)) {
41
-                $password = (string) $password;
41
+                $password = (string)$password;
42 42
             }
43 43
             if (!is_string($password)) {
44 44
                 trigger_error("password_hash(): Password must be a string", E_USER_WARNING);
45 45
                 return null;
46 46
             }
47 47
             if (!is_int($algo)) {
48
-                trigger_error("password_hash() expects parameter 2 to be long, " . gettype($algo) . " given", E_USER_WARNING);
48
+                trigger_error("password_hash() expects parameter 2 to be long, ".gettype($algo)." given", E_USER_WARNING);
49 49
                 return null;
50 50
             }
51 51
             $resultLength = 0;
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
                 case PASSWORD_BCRYPT:
54 54
                     $cost = PASSWORD_BCRYPT_DEFAULT_COST;
55 55
                     if (isset($options['cost'])) {
56
-                        $cost = (int) $options['cost'];
56
+                        $cost = (int)$options['cost'];
57 57
                         if ($cost < 4 || $cost > 31) {
58 58
                             trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING);
59 59
                             return null;
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
                     case 'integer':
80 80
                     case 'double':
81 81
                     case 'string':
82
-                        $salt = (string) $options['salt'];
82
+                        $salt = (string)$options['salt'];
83 83
                         break;
84 84
                     case 'object':
85 85
                         if (method_exists($options['salt'], '__tostring')) {
86
-                            $salt = (string) $options['salt'];
86
+                            $salt = (string)$options['salt'];
87 87
                             break;
88 88
                         }
89 89
                     case 'array':
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
                     if ($read >= $raw_salt_len) {
127 127
                         $buffer_valid = true;
128 128
                     }
129
-                    $buffer = str_pad($buffer, $raw_salt_len, "\0") ^ str_pad($local_buffer, $raw_salt_len, "\0");
129
+                    $buffer = str_pad($buffer, $raw_salt_len, "\0")^str_pad($local_buffer, $raw_salt_len, "\0");
130 130
                 }
131 131
                 if (!$buffer_valid || PasswordCompat\binary\_strlen($buffer) < $raw_salt_len) {
132 132
                     $buffer_length = PasswordCompat\binary\_strlen($buffer);
133 133
                     for ($i = 0; $i < $raw_salt_len; $i++) {
134 134
                         if ($i < $buffer_length) {
135
-                            $buffer[$i] = $buffer[$i] ^ chr(mt_rand(0, 255));
135
+                            $buffer[$i] = $buffer[$i]^chr(mt_rand(0, 255));
136 136
                         } else {
137 137
                             $buffer .= chr(mt_rand(0, 255));
138 138
                         }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
             }
154 154
             $salt = PasswordCompat\binary\_substr($salt, 0, $required_salt_len);
155 155
 
156
-            $hash = $hash_format . $salt;
156
+            $hash = $hash_format.$salt;
157 157
 
158 158
             $ret = crypt($password, $hash);
159 159
 
@@ -208,12 +208,12 @@  discard block
 block discarded – undo
208 208
          */
209 209
         function password_needs_rehash($hash, $algo, array $options = array()) {
210 210
             $info = password_get_info($hash);
211
-            if ($info['algo'] !== (int) $algo) {
211
+            if ($info['algo'] !== (int)$algo) {
212 212
                 return true;
213 213
             }
214 214
             switch ($algo) {
215 215
                 case PASSWORD_BCRYPT:
216
-                    $cost = isset($options['cost']) ? (int) $options['cost'] : PASSWORD_BCRYPT_DEFAULT_COST;
216
+                    $cost = isset($options['cost']) ? (int)$options['cost'] : PASSWORD_BCRYPT_DEFAULT_COST;
217 217
                     if ($cost !== $info['options']['cost']) {
218 218
                         return true;
219 219
                     }
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
             $status = 0;
244 244
             for ($i = 0; $i < PasswordCompat\binary\_strlen($ret); $i++) {
245
-                $status |= (ord($ret[$i]) ^ ord($hash[$i]));
245
+                $status |= (ord($ret[$i])^ord($hash[$i]));
246 246
             }
247 247
 
248 248
             return $status === 0;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -299,7 +299,7 @@
 block discarded – undo
299 299
          * @return boolean the check result
300 300
          */
301 301
         function check() {
302
-            static $pass = NULL;
302
+            static $pass = null;
303 303
 
304 304
             if (is_null($pass)) {
305 305
                 if (function_exists('crypt')) {
Please login to merge, or discard this patch.
html/inc/random_compat/random_bytes_com_dotnet.inc 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,7 @@
 block discarded – undo
38 38
      *
39 39
      * @return string
40 40
      */
41
-    function random_bytes($bytes)
42
-    {
41
+    function random_bytes($bytes) {
43 42
         try {
44 43
             $bytes = RandomCompat_intval($bytes);
45 44
         } catch (TypeError $ex) {
Please login to merge, or discard this patch.
html/inc/random_compat/random_bytes_libsodium_legacy.inc 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,10 +70,10 @@
 block discarded – undo
70 70
                 $n = ($bytes - $i) > 1073741824
71 71
                     ? 1073741824
72 72
                     : $bytes - $i;
73
-                $buf .= Sodium::randombytes_buf((int) $n);
73
+                $buf .= Sodium::randombytes_buf((int)$n);
74 74
             }
75 75
         } else {
76
-            $buf .= Sodium::randombytes_buf((int) $bytes);
76
+            $buf .= Sodium::randombytes_buf((int)$bytes);
77 77
         }
78 78
 
79 79
         if (is_string($buf)) {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,7 @@
 block discarded – undo
38 38
      *
39 39
      * @return string
40 40
      */
41
-    function random_bytes($bytes)
42
-    {
41
+    function random_bytes($bytes) {
43 42
         try {
44 43
             $bytes = RandomCompat_intval($bytes);
45 44
         } catch (TypeError $ex) {
Please login to merge, or discard this patch.
html/inc/random_compat/random_bytes_dev_urandom.inc 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,8 +44,7 @@
 block discarded – undo
44 44
      *
45 45
      * @return string
46 46
      */
47
-    function random_bytes($bytes)
48
-    {
47
+    function random_bytes($bytes) {
49 48
         static $fp = null;
50 49
         /**
51 50
          * This block should only be run once
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@
 block discarded – undo
141 141
                 /**
142 142
                  * @var string|bool
143 143
                  */
144
-                $buf = $buf . $read;
144
+                $buf = $buf.$read;
145 145
             } while ($remaining > 0);
146 146
 
147 147
             /**
Please login to merge, or discard this patch.
html/inc/random_compat/random_int.inc 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         }
79 79
 
80 80
         if ($max === $min) {
81
-            return (int) $min;
81
+            return (int)$min;
82 82
         }
83 83
 
84 84
         /**
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
              * type juggling
125 125
              */
126 126
             while ($range > 0) {
127
-                if ($bits % 8 === 0) {
127
+                if ($bits%8 === 0) {
128 128
                     ++$bytes;
129 129
                 }
130 130
                 ++$bits;
131 131
                 $range >>= 1;
132
-                $mask = $mask << 1 | 1;
132
+                $mask = $mask << 1|1;
133 133
             }
134 134
             $valueShift = $min;
135 135
         }
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
              */
168 168
             $val &= 0;
169 169
             for ($i = 0; $i < $bytes; ++$i) {
170
-                $val |= ord($randomByteString[$i]) << ($i * 8);
170
+                $val |= ord($randomByteString[$i]) << ($i*8);
171 171
             }
172 172
 
173 173
             /**
@@ -185,6 +185,6 @@  discard block
 block discarded – undo
185 185
              */
186 186
         } while (!is_int($val) || $val > $max || $val < $min);
187 187
 
188
-        return (int) $val;
188
+        return (int)$val;
189 189
     }
190 190
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,7 @@
 block discarded – undo
38 38
      *
39 39
      * @return int
40 40
      */
41
-    function random_int($min, $max)
42
-    {
41
+    function random_int($min, $max) {
43 42
         /**
44 43
          * Type and input logic checks
45 44
          *
Please login to merge, or discard this patch.
html/inc/random_compat/error_polyfill.inc 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,21 +28,18 @@
 block discarded – undo
28 28
 
29 29
 if (!class_exists('Error', false)) {
30 30
     // We can't really avoid making this extend Exception in PHP 5.
31
-    class Error extends Exception
32
-    {
31
+    class Error extends Exception {
33 32
         
34 33
     }
35 34
 }
36 35
 
37 36
 if (!class_exists('TypeError', false)) {
38 37
     if (is_subclass_of('Error', 'Exception')) {
39
-        class TypeError extends Error
40
-        {
38
+        class TypeError extends Error {
41 39
             
42 40
         }
43 41
     } else {
44
-        class TypeError extends Exception
45
-        {
42
+        class TypeError extends Exception {
46 43
             
47 44
         }
48 45
     }
Please login to merge, or discard this patch.
html/inc/random_compat/cast_to_int.inc 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,11 +60,11 @@
 block discarded – undo
60 60
             &&
61 61
             $number < PHP_INT_MAX
62 62
         ) {
63
-            $number = (int) $number;
63
+            $number = (int)$number;
64 64
         }
65 65
 
66 66
         if (is_int($number)) {
67
-            return (int) $number;
67
+            return (int)$number;
68 68
         } elseif (!$fail_open) {
69 69
             throw new TypeError(
70 70
                 'Expected an integer.'
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,7 @@
 block discarded – undo
45 45
      *
46 46
      * @throws TypeError
47 47
      */
48
-    function RandomCompat_intval($number, $fail_open = false)
49
-    {
48
+    function RandomCompat_intval($number, $fail_open = false) {
50 49
         if (is_int($number) || is_float($number)) {
51 50
             $number += 0;
52 51
         } elseif (is_numeric($number)) {
Please login to merge, or discard this patch.
html/inc/random_compat/random.inc 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
     $RandomCompatversion = array_map('intval', explode('.', PHP_VERSION));
35 35
     define(
36 36
         'PHP_VERSION_ID',
37
-        $RandomCompatversion[0] * 10000
38
-        + $RandomCompatversion[1] * 100
37
+        $RandomCompatversion[0]*10000
38
+        + $RandomCompatversion[1]*100
39 39
         + $RandomCompatversion[2]
40 40
     );
41 41
     $RandomCompatversion = null;
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 
55 55
 $RandomCompatDIR = dirname(__FILE__);
56 56
 
57
-require_once $RandomCompatDIR . '/byte_safe_strings.inc';
58
-require_once $RandomCompatDIR . '/cast_to_int.inc';
59
-require_once $RandomCompatDIR . '/error_polyfill.inc';
57
+require_once $RandomCompatDIR.'/byte_safe_strings.inc';
58
+require_once $RandomCompatDIR.'/cast_to_int.inc';
59
+require_once $RandomCompatDIR.'/error_polyfill.inc';
60 60
 
61 61
 if (!is_callable('random_bytes')) {
62 62
     /**
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
     if (extension_loaded('libsodium')) {
77 77
         // See random_bytes_libsodium.php
78 78
         if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) {
79
-            require_once $RandomCompatDIR . '/random_bytes_libsodium.inc';
79
+            require_once $RandomCompatDIR.'/random_bytes_libsodium.inc';
80 80
         } elseif (method_exists('Sodium', 'randombytes_buf')) {
81
-            require_once $RandomCompatDIR . '/random_bytes_libsodium_legacy.inc';
81
+            require_once $RandomCompatDIR.'/random_bytes_libsodium_legacy.inc';
82 82
         }
83 83
     }
84 84
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             // place, that is not helpful to us here.
118 118
 
119 119
             // See random_bytes_dev_urandom.php
120
-            require_once $RandomCompatDIR . '/random_bytes_dev_urandom.inc';
120
+            require_once $RandomCompatDIR.'/random_bytes_dev_urandom.inc';
121 121
         }
122 122
         // Unset variables after use
123 123
         $RandomCompat_basedir = null;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         extension_loaded('mcrypt')
160 160
     ) {
161 161
         // See random_bytes_mcrypt.php
162
-        require_once $RandomCompatDIR . '/random_bytes_mcrypt.inc';
162
+        require_once $RandomCompatDIR.'/random_bytes_mcrypt.inc';
163 163
     }
164 164
     $RandomCompatUrandom = null;
165 165
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                 $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1');
185 185
                 if (method_exists($RandomCompatCOMtest, 'GetRandom')) {
186 186
                     // See random_bytes_com_dotnet.php
187
-                    require_once $RandomCompatDIR . '/random_bytes_com_dotnet.inc';
187
+                    require_once $RandomCompatDIR.'/random_bytes_com_dotnet.inc';
188 188
                 }
189 189
             } catch (com_exception $e) {
190 190
                 // Don't try to use it.
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 }
220 220
 
221 221
 if (!is_callable('random_int')) {
222
-    require_once $RandomCompatDIR . '/random_int.inc';
222
+    require_once $RandomCompatDIR.'/random_int.inc';
223 223
 }
224 224
 
225 225
 $RandomCompatDIR = null;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -207,8 +207,7 @@
 block discarded – undo
207 207
          * @throws Exception
208 208
          * @return string
209 209
          */
210
-        function random_bytes($length)
211
-        {
210
+        function random_bytes($length) {
212 211
             unset($length); // Suppress "variable not used" warnings.
213 212
             throw new Exception(
214 213
                 'There is no suitable CSPRNG installed on your system'
Please login to merge, or discard this patch.
html/inc/random_compat/byte_safe_strings.inc 2 patches
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@  discard block
 block discarded – undo
43 43
          *
44 44
          * @return int
45 45
          */
46
-        function RandomCompat_strlen($binary_string)
47
-        {
46
+        function RandomCompat_strlen($binary_string) {
48 47
             if (!is_string($binary_string)) {
49 48
                 throw new TypeError(
50 49
                     'RandomCompat_strlen() expects a string'
@@ -66,8 +65,7 @@  discard block
 block discarded – undo
66 65
          *
67 66
          * @return int
68 67
          */
69
-        function RandomCompat_strlen($binary_string)
70
-        {
68
+        function RandomCompat_strlen($binary_string) {
71 69
             if (!is_string($binary_string)) {
72 70
                 throw new TypeError(
73 71
                     'RandomCompat_strlen() expects a string'
@@ -99,8 +97,7 @@  discard block
 block discarded – undo
99 97
          *
100 98
          * @return string
101 99
          */
102
-        function RandomCompat_substr($binary_string, $start, $length = null)
103
-        {
100
+        function RandomCompat_substr($binary_string, $start, $length = null) {
104 101
             if (!is_string($binary_string)) {
105 102
                 throw new TypeError(
106 103
                     'RandomCompat_substr(): First argument should be a string'
@@ -151,8 +148,7 @@  discard block
 block discarded – undo
151 148
          *
152 149
          * @return string
153 150
          */
154
-        function RandomCompat_substr($binary_string, $start, $length = null)
155
-        {
151
+        function RandomCompat_substr($binary_string, $start, $length = null) {
156 152
             if (!is_string($binary_string)) {
157 153
                 throw new TypeError(
158 154
                     'RandomCompat_substr(): First argument should be a string'
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
                 );
52 52
             }
53 53
 
54
-            return (int) mb_strlen($binary_string, '8bit');
54
+            return (int)mb_strlen($binary_string, '8bit');
55 55
         }
56 56
 
57 57
     } else {
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                     'RandomCompat_strlen() expects a string'
74 74
                 );
75 75
             }
76
-            return (int) strlen($binary_string);
76
+            return (int)strlen($binary_string);
77 77
         }
78 78
     }
79 79
 }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
                 return '';
134 134
             }
135 135
 
136
-            return (string) mb_substr($binary_string, $start, $length, '8bit');
136
+            return (string)mb_substr($binary_string, $start, $length, '8bit');
137 137
         }
138 138
 
139 139
     } else {
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
                     );
173 173
                 }
174 174
 
175
-                return (string) substr($binary_string, $start, $length);
175
+                return (string)substr($binary_string, $start, $length);
176 176
             }
177 177
 
178
-            return (string) substr($binary_string, $start);
178
+            return (string)substr($binary_string, $start);
179 179
         }
180 180
     }
181 181
 }
Please login to merge, or discard this patch.