@@ -1996,7 +1996,9 @@ |
||
| 1996 | 1996 | // Remove anything that isn't actually new from our list of files |
| 1997 | 1997 | foreach ($to_unset as $key => $ids) |
| 1998 | 1998 | { |
| 1999 | - if (array_reduce($ids, function($carry, $item) { return $carry * $item; }, true) == true) |
|
| 1999 | + if (array_reduce($ids, function($carry, $item) |
|
| 2000 | + { |
|
| 2001 | +return $carry * $item; }, true) == true) |
|
| 2000 | 2002 | unset($smiley_files[$key]); |
| 2001 | 2003 | } |
| 2002 | 2004 | |
@@ -3244,7 +3244,9 @@ |
||
| 3244 | 3244 | return $string; |
| 3245 | 3245 | |
| 3246 | 3246 | // This bit fixes incorrect string lengths, which can happen if the character encoding was changed (e.g. conversion to UTF-8) |
| 3247 | - $new_string = preg_replace_callback('~\bs:(\d+):"(.*?)";(?=$|[bidsa]:|[{}]|N;)~s', function($matches) {return 's:' . strlen($matches[2]) . ':"' . $matches[2] . '";'; }, $string); |
|
| 3247 | + $new_string = preg_replace_callback('~\bs:(\d+):"(.*?)";(?=$|[bidsa]:|[{}]|N;)~s', function($matches) |
|
| 3248 | + { |
|
| 3249 | +return 's:' . strlen($matches[2]) . ':"' . $matches[2] . '";'; }, $string); |
|
| 3248 | 3250 | |
| 3249 | 3251 | // @todo Add more possible fixes here. For example, fix incorrect array lengths, try to handle truncated strings gracefully, etc. |
| 3250 | 3252 | |
@@ -941,8 +941,9 @@ discard block |
||
| 941 | 941 | { |
| 942 | 942 | // Wait for a response that isn't continued with -, but don't wait too long. |
| 943 | 943 | $time = time(); |
| 944 | - do |
|
| 945 | - $this->last_message = fgets($this->connection, 1024); |
|
| 944 | + do { |
|
| 945 | + $this->last_message = fgets($this->connection, 1024); |
|
| 946 | + } |
|
| 946 | 947 | while ((strlen($this->last_message) < 4 || strpos($this->last_message, ' ') === 0 || strpos($this->last_message, ' ', 3) !== 3) && time() - $time < 5); |
| 947 | 948 | |
| 948 | 949 | // Was the desired response returned? |
@@ -963,8 +964,9 @@ discard block |
||
| 963 | 964 | // Request a passive connection - this means, we'll talk to you, you don't talk to us. |
| 964 | 965 | @fwrite($this->connection, 'PASV' . "\r\n"); |
| 965 | 966 | $time = time(); |
| 966 | - do |
|
| 967 | - $response = fgets($this->connection, 1024); |
|
| 967 | + do { |
|
| 968 | + $response = fgets($this->connection, 1024); |
|
| 969 | + } |
|
| 968 | 970 | while (strpos($response, ' ', 3) !== 3 && time() - $time < 5); |
| 969 | 971 | |
| 970 | 972 | // If it's not 227, we weren't given an IP and port, which means it failed. |
@@ -1086,8 +1088,9 @@ discard block |
||
| 1086 | 1088 | |
| 1087 | 1089 | @fwrite($this->connection, 'PWD' . "\r\n"); |
| 1088 | 1090 | $time = time(); |
| 1089 | - do |
|
| 1090 | - $response = fgets($this->connection, 1024); |
|
| 1091 | + do { |
|
| 1092 | + $response = fgets($this->connection, 1024); |
|
| 1093 | + } |
|
| 1091 | 1094 | while ($response[3] != ' ' && time() - $time < 5); |
| 1092 | 1095 | |
| 1093 | 1096 | // Check for 257! |
@@ -7196,7 +7196,6 @@ |
||
| 7196 | 7196 | |
| 7197 | 7197 | $length += array_length($value, $deep_count); |
| 7198 | 7198 | } |
| 7199 | - |
|
| 7200 | 7199 | else |
| 7201 | 7200 | $length += strlen($value); |
| 7202 | 7201 | } |