codeigniter4 / CodeIgniter4

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

Bug: `spark phpini:check` TypeError #9025

Closed aletoropov closed 2 months ago

aletoropov commented 3 months ago

PHP Version

8.1

CodeIgniter4 Version

4.5.3

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Linux

Which server did you use?

fpm-fcgi

Database

MySQL 8

What happened?

I tried to type in the console (Docker): php spark phpini:check And I got an error:

root@f117b1029506:/var/www# php spark phpini:check

CodeIgniter v4.5.3 Command Line Tool - Server Time: 2024-07-05 22:15:20 UTC+00:00

[TypeError]
CodeIgniter\CLI\CLI::color(): Argument #1 ($text) must be of type string, null given, called in /var/www/vendor/codeigniter4/framework/system/Security/CheckPhpIni.php on line 62
at SYSTEMPATH/CLI/CLI.php:58

Steps to Reproduce

php spark phpini:check

Expected Output

Executing a command

Anything else?

No response

kenjis commented 3 months ago

Can you show the all error message?

Cannot reproduce.

$ php spark phpini:check

CodeIgniter v4.5.3 Command Line Tool - Server Time: 2024-07-06 09:02:03 UTC+00:00

+-------------------------+---------+---------+-------------+-----------------------+
| Directive               | Global  | Current | Recommended | Remark                |
+-------------------------+---------+---------+-------------+-----------------------+
| error_reporting         | 22527   | 24575   | 5111        |                       |
| display_errors          |         | 0       | 0           |                       |
| display_startup_errors  |         | n/a     | 0           |                       |
| log_errors              | 1       | 1       |             |                       |
| error_log               |         |         |             |                       |
| default_charset         | UTF-8   | UTF-8   | UTF-8       |                       |
| memory_limit            | -1      | -1      |             | > post_max_size       |
| post_max_size           | 8M      | 8M      |             | > upload_max_filesize |
| upload_max_filesize     | 2M      | 2M      |             | < post_max_size       |
| request_order           | GP      | GP      | GP          |                       |
| variables_order         | GPCS    | GPCS    | GPCS        |                       |
| date.timezone           |         | n/a     | UTC         |                       |
| mbstring.language       | neutral | neutral | neutral     |                       |
| opcache.enable          | 1       | 1       | 1           |                       |
| opcache.enable_cli      | 0       | 0       |             |                       |
| opcache.jit             | tracing | tracing |             |                       |
| opcache.jit_buffer_size | 0       | 0       |             |                       |
+-------------------------+---------+---------+-------------+-----------------------+
aletoropov commented 3 months ago

This is all that is output to the console. I use a docker: https://github.com/aletoropov/docker_ci4 screenshot

kenjis commented 3 months ago

Okay, it seems there could be null.

array(17) {
  ["error_reporting"]=>
  array(4) {
    ["global"]=>
    string(4) "5111"
    ["current"]=>
    string(4) "5111"
    ["recommended"]=>
    string(4) "5111"
    ["remark"]=>
    string(0) ""
  }
  ["display_errors"]=>
  array(4) {
    ["global"]=>
    string(1) "1"
    ["current"]=>
    string(1) "0"
    ["recommended"]=>
    string(1) "0"
    ["remark"]=>
    string(0) ""
  }
  ["display_startup_errors"]=>
  array(4) {
    ["global"]=>
    string(1) "1"
    ["current"]=>
    string(1) "1"
    ["recommended"]=>
    string(1) "0"
    ["remark"]=>
    string(0) ""
  }
  ["log_errors"]=>
  array(4) {
    ["global"]=>
    string(1) "0"
    ["current"]=>
    string(1) "0"
    ["recommended"]=>
    string(0) ""
    ["remark"]=>
    string(0) ""
  }
  ["error_log"]=>
  array(4) {
    ["global"]=>
    NULL
    ["current"]=>
    NULL
    ["recommended"]=>
    string(0) ""
    ["remark"]=>
    string(0) ""
  }
  ["default_charset"]=>
  array(4) {
    ["global"]=>
    string(5) "UTF-8"
    ["current"]=>
    string(5) "UTF-8"
    ["recommended"]=>
    string(5) "UTF-8"
    ["remark"]=>
    string(0) ""
  }
  ["memory_limit"]=>
  array(4) {
    ["global"]=>
    string(2) "4G"
    ["current"]=>
    string(2) "4G"
    ["recommended"]=>
    string(0) ""
    ["remark"]=>
    string(15) "> post_max_size"
  }
  ["post_max_size"]=>
  array(4) {
    ["global"]=>
    string(2) "8M"
    ["current"]=>
    string(2) "8M"
    ["recommended"]=>
    string(0) ""
    ["remark"]=>
    string(21) "> upload_max_filesize"
  }
  ["upload_max_filesize"]=>
  array(4) {
    ["global"]=>
    string(2) "2M"
    ["current"]=>
    string(2) "2M"
    ["recommended"]=>
    string(0) ""
    ["remark"]=>
    string(15) "< post_max_size"
  }
  ["request_order"]=>
  array(4) {
    ["global"]=>
    NULL
    ["current"]=>
    NULL
    ["recommended"]=>
    string(2) "GP"
    ["remark"]=>
    string(0) ""
  }
  ["variables_order"]=>
  array(4) {
    ["global"]=>
    string(5) "EGPCS"
    ["current"]=>
    string(5) "EGPCS"
    ["recommended"]=>
    string(4) "GPCS"
    ["remark"]=>
    string(0) ""
  }
  ["date.timezone"]=>
  array(4) {
    ["global"]=>
    string(0) ""
    ["current"]=>
    string(0) ""
    ["recommended"]=>
    string(3) "UTC"
    ["remark"]=>
    string(0) ""
  }
  ["mbstring.language"]=>
  array(4) {
    ["global"]=>
    string(7) "neutral"
    ["current"]=>
    string(7) "neutral"
    ["recommended"]=>
    string(7) "neutral"
    ["remark"]=>
    string(0) ""
  }
  ["opcache.enable"]=>
  array(4) {
    ["global"]=>
    string(8) "disabled"
    ["current"]=>
    string(8) "disabled"
    ["recommended"]=>
    string(1) "1"
    ["remark"]=>
    string(0) ""
  }
  ["opcache.enable_cli"]=>
  array(4) {
    ["global"]=>
    string(8) "disabled"
    ["current"]=>
    string(8) "disabled"
    ["recommended"]=>
    string(0) ""
    ["remark"]=>
    string(0) ""
  }
  ["opcache.jit"]=>
  array(4) {
    ["global"]=>
    string(8) "disabled"
    ["current"]=>
    string(8) "disabled"
    ["recommended"]=>
    string(0) ""
    ["remark"]=>
    string(0) ""
  }
  ["opcache.jit_buffer_size"]=>
  array(4) {
    ["global"]=>
    string(8) "disabled"
    ["current"]=>
    string(8) "disabled"
    ["recommended"]=>
    string(0) ""
    ["remark"]=>
    string(0) ""
  }
}
kenjis commented 3 months ago

@aletoropov Check #9026