@@ -276,18 +276,18 @@ |
||
| 276 | 276 | * @return array |
| 277 | 277 | */ |
| 278 | 278 | private function parseIndexErrorException(Exception $e): array { |
| 279 | - // Remove leading ErrorMessage like: "400 Bad Request: " from ElasticSearch to make json_decode work again |
|
| 280 | - $jsonexmsg = preg_replace('/^[^{]*/', '', $e->getMessage()); |
|
| 281 | - $arr = json_decode($jsonexmsg, true); |
|
| 282 | - |
|
| 283 | - if (!is_array($arr)) { |
|
| 284 | - // If still parsing is impossible give a hint on what went wrong (parsing) in logs... |
|
| 285 | - $jsonerror = json_last_error_msg(); |
|
| 286 | - $this->logger->error(sprintf("parseIndexErrorException(%s): ex=%s", $jsonerror, $jsonexmsg)); |
|
| 287 | - |
|
| 288 | - // Give a hint in the unknown error what went wrong |
|
| 289 | - return ['error', 'unknown error: ' + $jsonexmsg, '']; |
|
| 290 | - } |
|
| 279 | + // Remove leading ErrorMessage like: "400 Bad Request: " from ElasticSearch to make json_decode work again |
|
| 280 | + $jsonexmsg = preg_replace('/^[^{]*/', '', $e->getMessage()); |
|
| 281 | + $arr = json_decode($jsonexmsg, true); |
|
| 282 | + |
|
| 283 | + if (!is_array($arr)) { |
|
| 284 | + // If still parsing is impossible give a hint on what went wrong (parsing) in logs... |
|
| 285 | + $jsonerror = json_last_error_msg(); |
|
| 286 | + $this->logger->error(sprintf("parseIndexErrorException(%s): ex=%s", $jsonerror, $jsonexmsg)); |
|
| 287 | + |
|
| 288 | + // Give a hint in the unknown error what went wrong |
|
| 289 | + return ['error', 'unknown error: ' + $jsonexmsg, '']; |
|
| 290 | + } |
|
| 291 | 291 | |
| 292 | 292 | if (empty($this->getArray('error', $arr))) { |
| 293 | 293 | return ['error', $e->getMessage(), '']; |
@@ -81,12 +81,12 @@ discard block |
||
| 81 | 81 | $hosts = $this->getElasticHost(); |
| 82 | 82 | foreach ($hosts as $host) { |
| 83 | 83 | $parsedHost = parse_url($host); |
| 84 | - $safeHost = $parsedHost['scheme'] . '://'; |
|
| 84 | + $safeHost = $parsedHost['scheme'].'://'; |
|
| 85 | 85 | if (array_key_exists('user', $parsedHost)) { |
| 86 | - $safeHost .= $parsedHost['user'] . ':' . '********' . '@'; |
|
| 86 | + $safeHost .= $parsedHost['user'].':'.'********'.'@'; |
|
| 87 | 87 | } |
| 88 | 88 | $safeHost .= $parsedHost['host']; |
| 89 | - $safeHost .= ':' . $parsedHost['port']; |
|
| 89 | + $safeHost .= ':'.$parsedHost['port']; |
|
| 90 | 90 | |
| 91 | 91 | $sanitizedHosts[] = $safeHost; |
| 92 | 92 | } |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | $this->logger->error(sprintf("parseIndexErrorException(%s): ex=%s", $jsonerror, $jsonexmsg)); |
| 287 | 287 | |
| 288 | 288 | // Give a hint in the unknown error what went wrong |
| 289 | - return ['error', 'unknown error: ' + $jsonexmsg, '']; |
|
| 289 | + return ['error', 'unknown error: ' +$jsonexmsg, '']; |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | if (empty($this->getArray('error', $arr))) { |