Skip to content

Commit

Permalink
fix: handle edge case of 'cgi-fcgi' and 'fpm-fcgi'
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Dec 8, 2021
1 parent 29f8bf8 commit 00fc585
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion system/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,13 @@ function helper($filenames)
*/
function is_cli(): bool
{
return in_array(PHP_SAPI, ['cli', 'phpdbg'], true);
if (in_array(PHP_SAPI, ['cli', 'phpdbg'], true)) {
return true;
}

// PHP_SAPI could be 'cgi-fcgi', 'fpm-fcgi'.
// See https://github.com/codeigniter4/CodeIgniter4/pull/5393
return ! isset($_SERVER['REMOTE_ADDR']) && ! isset($_SERVER['REQUEST_METHOD']);
}
}

Expand Down

0 comments on commit 00fc585

Please sign in to comment.