From 3f8f2c3b47d64da346794f89305da18eec8f9742 Mon Sep 17 00:00:00 2001 From: Ron Oerlemans Date: Mon, 19 Aug 2024 15:02:10 +0200 Subject: [PATCH 1/2] Fix a problem where the header only contains 200 I got this as a response, but still would be valid: ``` HTTP/1.1 200 ``` --- src/OpenGraph.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenGraph.php b/src/OpenGraph.php index fec28c0..49ffbf7 100644 --- a/src/OpenGraph.php +++ b/src/OpenGraph.php @@ -111,7 +111,7 @@ protected function verify_image_url($url) ]); $headers = get_headers($url, true, $context_headers); - return stripos($headers[0], '200 OK') ? true : false; + return stripos($headers[0], '200') ? true : false; } catch (\Exception $e) { return false; } From da69f472bb2e98b0d2bfedaa87bb4e071d733f36 Mon Sep 17 00:00:00 2001 From: Ron Oerlemans Date: Wed, 11 Dec 2024 12:07:51 +0100 Subject: [PATCH 2/2] Make check more safe --- src/OpenGraph.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenGraph.php b/src/OpenGraph.php index 49ffbf7..cd47a5d 100644 --- a/src/OpenGraph.php +++ b/src/OpenGraph.php @@ -111,7 +111,7 @@ protected function verify_image_url($url) ]); $headers = get_headers($url, true, $context_headers); - return stripos($headers[0], '200') ? true : false; + return stripos($headers[0], '200') !== false; } catch (\Exception $e) { return false; }