codeigniter4 / CodeIgniter4

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
5.35k stars 1.9k forks source link

Bug: Rules for is_cli() are too restrictive #4843

Closed michalsn closed 3 years ago

michalsn commented 3 years ago

Describe the bug I came across this because some benchmarks stopped working: https://the-benchmarker.semaphoreci.com/jobs/21790820-d57f-4457-834e-2f93bdddef91. No matter what URL we would enter, the default route would be fired instead.

I started looking at it closely and figured out that new rules in the is_cli() function are the reason - exactly these:

if (stristr(PHP_SAPI, 'cgi') && getenv('TERM')) {
    return true;
}

Values for these are:

PHP_SAPI => fpm-fcgi
getenv('TERM') => xterm

Here is a Dockerfile: https://github.com/the-benchmarker/web-frameworks/blob/master/php/Dockerfile it can be tested by anyone.

CodeIgniter 4 version 4.1.3 and above

Affected module(s) is_cli() function

Sorry if this is a little chaotic - I can provide more information later if needed.

paulbalandan commented 3 years ago

Fixed in 8d09d10.