Passed
Pull Request — release-2.1 (#6262)
by Jeremy
04:04
created
Sources/Subs-BoardIndex.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -419,7 +419,7 @@
 block discarded – undo
419 419
 					$board['last_post']['last_post_message'] = sprintf($txt['last_post_message'], $board['last_post']['member']['link'], $board['last_post']['link'], $board['last_post']['time'] > 0 ? timeformat($board['last_post']['time']) : $txt['not_applicable']);
420 420
 			}
421 421
 		}
422
-	else
422
+		else
423 423
 		foreach ($this_category as &$board)
424 424
 		{
425 425
 			if (!empty($moderators[$board['id']]))
Please login to merge, or discard this patch.
Sources/Subs-Db-postgresql.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -979,7 +979,8 @@  discard block
 block discarded – undo
979 979
 		$error_array[2] = null;
980 980
 
981 981
 	if(empty($db_persist))
982
-	{ // without pooling
982
+	{
983
+// without pooling
983 984
 		if (empty($pg_error_data_prep))
984 985
 			$pg_error_data_prep = pg_prepare($db_connection, 'smf_log_errors',
985 986
 				'INSERT INTO ' . $db_prefix . 'log_errors
@@ -990,7 +991,8 @@  discard block
 block discarded – undo
990 991
 		pg_execute($db_connection, 'smf_log_errors', $error_array);
991 992
 	}
992 993
 	else
993
-	{ //with pooling
994
+	{
995
+//with pooling
994 996
 		$pg_error_data_prep = pg_prepare($db_connection, '',
995 997
 			'INSERT INTO ' . $db_prefix . 'log_errors
996 998
 				(id_member, log_time, ip, url, message, session, error_type, file, line, backtrace)
Please login to merge, or discard this patch.
Sources/random_compat/random_bytes_dev_urandom.php 1 patch
Braces   +33 added lines, -16 removed lines patch added patch discarded remove patch
@@ -26,11 +26,13 @@  discard block
 block discarded – undo
26 26
  * SOFTWARE.
27 27
  */
28 28
 
29
-if (!defined('RANDOM_COMPAT_READ_BUFFER')) {
29
+if (!defined('RANDOM_COMPAT_READ_BUFFER'))
30
+{
30 31
     define('RANDOM_COMPAT_READ_BUFFER', 8);
31 32
 }
32 33
 
33
-if (!is_callable('random_bytes')) {
34
+if (!is_callable('random_bytes'))
35
+{
34 36
     /**
35 37
      * Unless open_basedir is enabled, use /dev/urandom for
36 38
      * random numbers in accordance with best practices
@@ -52,23 +54,27 @@  discard block
 block discarded – undo
52 54
         /**
53 55
          * This block should only be run once
54 56
          */
55
-        if (empty($fp)) {
57
+        if (empty($fp))
58
+        {
56 59
             /**
57 60
              * We use /dev/urandom if it is a char device.
58 61
              * We never fall back to /dev/random
59 62
              */
60 63
             /** @var resource|bool $fp */
61 64
             $fp = fopen('/dev/urandom', 'rb');
62
-            if (is_resource($fp)) {
65
+            if (is_resource($fp))
66
+            {
63 67
                 /** @var array<string, int> $st */
64 68
                 $st = fstat($fp);
65
-                if (($st['mode'] & 0170000) !== 020000) {
69
+                if (($st['mode'] & 0170000) !== 020000)
70
+                {
66 71
                     fclose($fp);
67 72
                     $fp = false;
68 73
                 }
69 74
             }
70 75
 
71
-            if (is_resource($fp)) {
76
+            if (is_resource($fp))
77
+            {
72 78
                 /**
73 79
                  * stream_set_read_buffer() does not exist in HHVM
74 80
                  *
@@ -77,25 +83,31 @@  discard block
 block discarded – undo
77 83
                  *
78 84
                  * stream_set_read_buffer returns 0 on success
79 85
                  */
80
-                if (is_callable('stream_set_read_buffer')) {
86
+                if (is_callable('stream_set_read_buffer'))
87
+                {
81 88
                     stream_set_read_buffer($fp, RANDOM_COMPAT_READ_BUFFER);
82 89
                 }
83
-                if (is_callable('stream_set_chunk_size')) {
90
+                if (is_callable('stream_set_chunk_size'))
91
+                {
84 92
                     stream_set_chunk_size($fp, RANDOM_COMPAT_READ_BUFFER);
85 93
                 }
86 94
             }
87 95
         }
88 96
 
89
-        try {
97
+        try
98
+        {
90 99
             /** @var int $bytes */
91 100
             $bytes = RandomCompat_intval($bytes);
92
-        } catch (TypeError $ex) {
101
+        }
102
+        catch (TypeError $ex)
103
+        {
93 104
             throw new TypeError(
94 105
                 'random_bytes(): $bytes must be an integer'
95 106
             );
96 107
         }
97 108
 
98
-        if ($bytes < 1) {
109
+        if ($bytes < 1)
110
+        {
99 111
             throw new Error(
100 112
                 'Length must be greater than 0'
101 113
             );
@@ -108,7 +120,8 @@  discard block
 block discarded – undo
108 120
          * if (empty($fp)) line is logic that should only be run once per
109 121
          * page load.
110 122
          */
111
-        if (is_resource($fp)) {
123
+        if (is_resource($fp))
124
+        {
112 125
             /**
113 126
              * @var int
114 127
              */
@@ -127,8 +140,10 @@  discard block
 block discarded – undo
127 140
                  * @var string|bool
128 141
                  */
129 142
                 $read = fread($fp, $remaining);
130
-                if (!is_string($read)) {
131
-                    if ($read === false) {
143
+                if (!is_string($read))
144
+                {
145
+                    if ($read === false)
146
+                    {
132 147
                         /**
133 148
                          * We cannot safely read from the file. Exit the
134 149
                          * do-while loop and trigger the exception condition
@@ -152,8 +167,10 @@  discard block
 block discarded – undo
152 167
             /**
153 168
              * Is our result valid?
154 169
              */
155
-            if (is_string($buf)) {
156
-                if (RandomCompat_strlen($buf) === $bytes) {
170
+            if (is_string($buf))
171
+            {
172
+                if (RandomCompat_strlen($buf) === $bytes)
173
+                {
157 174
                     /**
158 175
                      * Return our random entropy buffer here:
159 176
                      */
Please login to merge, or discard this patch.
Sources/Subs-Admin.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1197,7 +1197,8 @@  discard block
 block discarded – undo
1197 1197
 	}
1198 1198
 
1199 1199
 	// It's important to do the numbered ones before the named ones, or messes happen.
1200
-	uksort($substitutions, function($a, $b) {
1200
+	uksort($substitutions, function($a, $b)
1201
+	{
1201 1202
 		if (is_int($a) && is_int($b))
1202 1203
 			return $a > $b;
1203 1204
 		elseif (is_int($a))
@@ -1716,8 +1717,12 @@  discard block
 block discarded – undo
1716 1717
 		unset($mtime, $settingsFile, $settingsText);
1717 1718
 		$defined_vars = get_defined_vars();
1718 1719
 	}
1719
-	catch (Throwable $e) {}
1720
-	catch (ErrorException $e) {}
1720
+	catch (Throwable $e)
1721
+	{
1722
+}
1723
+	catch (ErrorException $e)
1724
+	{
1725
+}
1721 1726
 	if (isset($e))
1722 1727
 		return false;
1723 1728
 
@@ -1877,7 +1882,8 @@  discard block
 block discarded – undo
1877 1882
 	// For the same reason, replace literal returns and newlines with "\r" and "\n"
1878 1883
 	elseif (is_string($var) && (strpos($var, "\n") !== false || strpos($var, "\r") !== false))
1879 1884
 	{
1880
-		return strtr(preg_replace_callback('/[\r\n]+/', function($m) {
1885
+		return strtr(preg_replace_callback('/[\r\n]+/', function($m)
1886
+		{
1881 1887
 			return '\' . "' . strtr($m[0], array("\r" => '\r', "\n" => '\n')) . '" . \'';
1882 1888
 		}, $var), array("'' . " => '', " . ''" => ''));
1883 1889
 	}
Please login to merge, or discard this patch.
Sources/Subs.php 1 patch
Braces   +3 added lines, -8 removed lines patch added patch discarded remove patch
@@ -279,7 +279,6 @@  discard block
 block discarded – undo
279 279
 		$condition = 'id_member IN ({array_int:members})';
280 280
 		$parameters['members'] = $members;
281 281
 	}
282
-
283 282
 	elseif ($members === null)
284 283
 		$condition = '1=1';
285 284
 
@@ -382,11 +381,9 @@  discard block
 block discarded – undo
382 381
 				$val = $val . ' END';
383 382
 				$type = 'raw';
384 383
 			}
385
-
386 384
 			else
387 385
 				$val = alert_count($members, true);
388 386
 		}
389
-
390 387
 		elseif ($type == 'int' && ($val === '+' || $val === '-'))
391 388
 		{
392 389
 			$val = $var . ' ' . $val . ' 1';
@@ -2176,12 +2173,12 @@  discard block
 block discarded – undo
2176 2173
 			'tag' => 'cowsay',
2177 2174
 			'parameters' => array(
2178 2175
 				'e' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => 'oo', 'validate' => function ($eyes) use ($smcFunc)
2179
-					{
2176
+				{
2180 2177
 						return $smcFunc['substr']($eyes . 'oo', 0, 2);
2181 2178
 					},
2182 2179
 				),
2183 2180
 				't' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => '  ', 'validate' => function ($tongue) use ($smcFunc)
2184
-					{
2181
+				{
2185 2182
 						return $smcFunc['substr']($tongue . '  ', 0, 2);
2186 2183
 					},
2187 2184
 				),
@@ -3279,7 +3276,7 @@  discard block
 block discarded – undo
3279 3276
 
3280 3277
 	// Replace away!
3281 3278
 	$message = preg_replace_callback($smileyPregSearch, function($matches) use ($smileyPregReplacements)
3282
-		{
3279
+	{
3283 3280
 			return $smileyPregReplacements[$matches[1]];
3284 3281
 		}, $message);
3285 3282
 }
@@ -4077,7 +4074,6 @@  discard block
 block discarded – undo
4077 4074
 				if (!isset($minSeed) && isset($js_file['options']['seed']))
4078 4075
 					$minSeed = $js_file['options']['seed'];
4079 4076
 			}
4080
-
4081 4077
 			else
4082 4078
 			{
4083 4079
 				echo '
@@ -6360,7 +6356,6 @@  discard block
 block discarded – undo
6360 6356
 			$isWritable = true;
6361 6357
 			break;
6362 6358
 		}
6363
-
6364 6359
 		else
6365 6360
 			@chmod($file, $val);
6366 6361
 	}
Please login to merge, or discard this patch.