Permalink
Browse files

`get_headers` can return `false`

[skip ci]
  • Loading branch information...
mwjames committed Jan 12, 2019
1 parent a5a4a0d commit 8bc4443a6a48682e74e94a014adfcd91cb6104a5
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/Elastic/Indexer/FileIndexer.php
@@ -198,7 +198,7 @@ public function index( DIWikiPage $dataItem, File $file = null ) {
// Avoid a "failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found"
$file_headers = @get_headers( $url );
if ( $file_headers[0] !== 'HTTP/1.1 404 Not Found' && $file_headers[0] !== 'HTTP/1.0 404 Not Found' ) {
if ( $file_headers !== false && $file_headers[0] !== 'HTTP/1.1 404 Not Found' && $file_headers[0] !== 'HTTP/1.0 404 Not Found' ) {
$contents = file_get_contents( $url );
} else {
$this->logger->info( [ 'File indexer', "HTTP/1.1 404 Not Found for $url" ], $context );

0 comments on commit 8bc4443

Please sign in to comment.