Skip to content

Commit

Permalink
fix: get rid of (some) PHP deprecation warnings
Browse files Browse the repository at this point in the history
- RequestHandlerComponent might not have CONTENT_TYPE env set
- basics.php might not have SCRIPT_URI env set
  • Loading branch information
Jan Pešek authored and kamilwylegala committed Oct 20, 2023
1 parent 41af03e commit 0f1bb51
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/Controller/Component/RequestHandlerComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ public function requestedWith($type = null) {
return false;
}

list($contentType) = explode(';', env('CONTENT_TYPE'));
list($contentType) = explode(';', env('CONTENT_TYPE') ?? '');
if ($contentType === '') {
list($contentType) = explode(';', CakeRequest::header('CONTENT_TYPE'));
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/basics.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ function env($key) {
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') {
Expand Down

0 comments on commit 0f1bb51

Please sign in to comment.