Skip to content

Commit 00152b5

Browse files
committed
[BUGFIX] Trying to get property of non-object error
During indexing I got a 'Trying to get property of non-object' error in the NodeIndexer on a line that contained invalid json (a truncated error message). This change makes sure an error is logged if invalid json is returned.
1 parent a9deb98 commit 00152b5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • Classes/Flowpack/ElasticSearch/ContentRepositoryAdaptor/Indexer

Classes/Flowpack/ElasticSearch/ContentRepositoryAdaptor/Indexer/NodeIndexer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public function flush() {
368368
$responseAsLines = $this->getIndex()->request('POST', '/_bulk', array(), $content)->getOriginalResponse()->getContent();
369369
foreach (explode('\n', $responseAsLines) as $responseLine) {
370370
$response = json_decode($responseLine);
371-
if ($response->errors !== FALSE) {
371+
if (!is_object($response) || $response->errors !== FALSE) {
372372
$this->logger->log('Indexing Error: ' . $responseLine, LOG_ERR);
373373
}
374374
}

0 commit comments

Comments
 (0)