Skip to content
Snippets Groups Projects
Commit f676468b authored by Bram Driesen's avatar Bram Driesen
Browse files

Issue #3358177 by farid.muborakshoev, BramDriesen: json_decode() failed when...

Issue #3358177 by farid.muborakshoev, BramDriesen: json_decode() failed when handling invalid JSON response
parent 2df4de12
No related branches found
No related tags found
No related merge requests found
Pipeline #191406 passed with warnings
......@@ -77,7 +77,13 @@ class Collector implements CollectorInterface {
}
else {
$json = $response->getBody()->getContents();
$json = preg_replace( '/[\x{200B}-\x{200D}\x{FEFF}]/u', '', $json );
$values = json_decode($json, TRUE);
if (is_null($values)) {
$msg = json_last_error_msg();
$this->logger->error("JSON cannot be decoded: $msg");
return;
}
$storage = $this->entityTypeManager->getStorage('client_site');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment