From 0f1bb514025cf764fa0e7e84db2f40198d5bd3b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Pe=C5=A1ek?= Date: Thu, 19 Oct 2023 10:09:26 +0200 Subject: [PATCH] fix: get rid of (some) PHP deprecation warnings - RequestHandlerComponent might not have CONTENT_TYPE env set - basics.php might not have SCRIPT_URI env set --- lib/Cake/Controller/Component/RequestHandlerComponent.php | 2 +- lib/Cake/basics.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Controller/Component/RequestHandlerComponent.php b/lib/Cake/Controller/Component/RequestHandlerComponent.php index 1915b981a..513af4029 100644 --- a/lib/Cake/Controller/Component/RequestHandlerComponent.php +++ b/lib/Cake/Controller/Component/RequestHandlerComponent.php @@ -531,7 +531,7 @@ class RequestHandlerComponent extends Component { return false; } - list($contentType) = explode(';', env('CONTENT_TYPE')); + list($contentType) = explode(';', env('CONTENT_TYPE') ?? ''); if ($contentType === '') { list($contentType) = explode(';', CakeRequest::header('CONTENT_TYPE')); } diff --git a/lib/Cake/basics.php b/lib/Cake/basics.php index 10d965c1c..0e9f13956 100644 --- a/lib/Cake/basics.php +++ b/lib/Cake/basics.php @@ -323,7 +323,7 @@ if (!function_exists('env')) { if (isset($_SERVER['HTTPS'])) { return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'); } - return (strpos(env('SCRIPT_URI'), 'https://') === 0); + return (strpos(env('SCRIPT_URI') ?? '', 'https://') === 0); } if ($key === 'SCRIPT_NAME') {