Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Kint 4.1 breaking change VT100 support #5522

Closed
jbotka opened this issue Jan 1, 2022 · 7 comments
Closed

Bug: Kint 4.1 breaking change VT100 support #5522

jbotka opened this issue Jan 1, 2022 · 7 comments
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@jbotka
Copy link
Contributor

jbotka commented Jan 1, 2022

PHP Version

8.1

CodeIgniter4 Version

4.1.5

CodeIgniter4 Installation Method

Git

Which operating systems have you tested for this bug?

Windows

Which server did you use?

apache

Database

No response

What happened?

Not sure if this should be targeted here or in the Kint repository. But release 4.1 has change -> 71a80e0. This change causes in CI error:

CRITICAL - 2022-01-01 14:03:30 --> Undefined constant "Kint\Renderer\STDOUT"
#0 C:\WebRoot\x\system\CodeIgniter.php(186): CodeIgniter\CodeIgniter->initializeKint()
#1 C:\WebRoot\x\system\bootstrap.php(146): CodeIgniter\CodeIgniter->initialize()
#2 C:\WebRoot\x\public\index.php(28): require('C:\WebRoot\x...')
#3 {main}

Steps to Reproduce

Update composer to latest packages so Kint will be 4.1 and use for OS Windows.

Expected Output

Normal bootstrap of application.

Anything else?

No response

@jbotka jbotka added the bug Verified issues on the current code behavior or pull requests that will fix them label Jan 1, 2022
@kenjis
Copy link
Member

kenjis commented Jan 2, 2022

First of all, CI 4.1.5 does not support PHP 8.1.

I have confirmed this error with develop on macOS.

Error
Undefined constant "Kint\Renderer\STDOUT"
SYSTEMPATH/CodeIgniter.php at line 272

Is this a bug of CI4? Or is there any use case to use CliRenderer on web?

--- a/system/CodeIgniter.php
+++ b/system/CodeIgniter.php
@@ -269,10 +269,12 @@ class CodeIgniter
             RichRenderer::$tab_plugins = $config->richTabPlugins;
         }
 
-        CliRenderer::$cli_colors         = $config->cliColors;
-        CliRenderer::$force_utf8         = $config->cliForceUTF8;
-        CliRenderer::$detect_width       = $config->cliDetectWidth;
-        CliRenderer::$min_terminal_width = $config->cliMinWidth;
+        if (is_cli()) {
+            CliRenderer::$cli_colors         = $config->cliColors;
+            CliRenderer::$force_utf8         = $config->cliForceUTF8;
+            CliRenderer::$detect_width       = $config->cliDetectWidth;
+            CliRenderer::$min_terminal_width = $config->cliMinWidth;
+        }
     }
 
     /**

@kenjis
Copy link
Member

kenjis commented Jan 2, 2022

It seems this is a bug of Kint. I'm going to report to the Kint repository.

@kenjis
Copy link
Member

kenjis commented Jan 2, 2022

@xbotkaj As a workaround, I recommend to fix Kint version.

--- a/composer.json
+++ b/composer.json
@@ -10,7 +10,7 @@
         "ext-intl": "*",
         "ext-json": "*",
         "ext-mbstring": "*",
-        "kint-php/kint": "^4.0",
+        "kint-php/kint": "4.0",
         "laminas/laminas-escaper": "^2.9",
         "psr/log": "^1.1"
     },

@jbotka
Copy link
Contributor Author

jbotka commented Jan 2, 2022

Thank You @kenjis . It seems that Kint already patched this issue with release 4.1.1 so I am closing this issue. Thank You

@DRSDavidSoft
Copy link

@xbotkaj I'd like to chime in and apologize for the breaking change, I had asked for some changes to better support Windows CLI -- this ended up with the undefined STDOUT constant on some platforms, which broke the CI test

is there any use case to use CliRenderer on web?

@kenjis There is, although not a general use case. Here's an example of how it could be beneficial using the built-in web server: kint-php/kint#380 (comment)

(This is a relative niche use case, and I'm not sure if there would be other use cases for such functionality.)

Of course, thanks to jnvsor this issue was quickly patched in Kint. Hopefully there wouldn't be other breaking changes in the future.

@kenjis
Copy link
Member

kenjis commented Jan 4, 2022

@DRSDavidSoft Thank you for your info.
It seem to be better to decouple the Server API or environment (web or cli) from the output.

@jbotka
Copy link
Contributor Author

jbotka commented Jan 4, 2022

@DRSDavidSoft No problem at all. It was not in production so fine for me :) Thank You for super fast fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

No branches or pull requests

3 participants