Tinker is not using colors, all the text is white only, this issue happened when I installed a latest version of Laravel ( 8.47.0 ),
I went to try some oldest versions of Laravel ( 8.46.0 and older ) tinker worked fine, text was colored fine,
what should we do?
Steps To Reproduce The Issue:
It happens whenever we create a fresh Laravel project with composer
PsySH (and thus Tinker) treats --ansi / --no-ansi as a three-state pair of options: either you specify explicitly that you want color, or explicitly don't, or the app decides for you.
As of the latest Symfony, the built-in --ansi option is defined as "negatable". So if you don't explicitly specify --ansi, it acts like you've implicitly specified --no-ansi. So when PsySH tries to figure out whether you want color or not, the latest Symfony lies and says you don't.
One additional complication, though: Symfony Console, itself, doesn't parse those options that way, despite defining them that way. So I'm pretty convinced this is a bug in the default --ansi option definition, and we shouldn't be using negatable like this.
Anyway, it looks like that change will be reverted until Symfony 6.0 because it also caused backwards compatibility breaks (as it did for us), so we can fight that fight later 😛
In the meantime, specifying --color or --ansi to force the color on should work!
Since this is now closed, while i personally think it should be open while we keep track of it and until it gets fixed here's a simple quickfix for people encountering this. Simply run tinker like this:
php artisan tinker --ansi - this forces the color output :)
Description:
Tinker is not using colors, all the text is white only, this issue happened when I installed a latest version of Laravel ( 8.47.0 ), I went to try some oldest versions of Laravel ( 8.46.0 and older ) tinker worked fine, text was colored fine, what should we do?
Steps To Reproduce The Issue:
It happens whenever we create a fresh Laravel project with composer
Samples
cmd
cmder
Please provide a way for us to reproduce this.
Which PsySH version is working for you, and which is not?
@driesvints, for me it happens when ever I create a fresh Laravel project via composer, my excuses for not providing more info
@bobthecow, so far Psy Shell v0.10.8, I edited the report, please check it
What does running
psy\info()
inside tinker output in both cases?@bobthecow thanks for helping out here 👍
@bobthecow,
@bobthecow,, want to update you, I found a file in "vendor/psy/psysh/src/configuration.php" where a line was
is it a good way to turn it into 'auto' too
I believe this issue is https://github.com/symfony/symfony/pull/41723, though not for any of the reasons already listed on that issue.
PsySH (and thus Tinker) treats
--ansi
/--no-ansi
as a three-state pair of options: either you specify explicitly that you want color, or explicitly don't, or the app decides for you.As of the latest Symfony, the built-in
--ansi
option is defined as "negatable". So if you don't explicitly specify--ansi
, it acts like you've implicitly specified--no-ansi
. So when PsySH tries to figure out whether you want color or not, the latest Symfony lies and says you don't.One additional complication, though: Symfony Console, itself, doesn't parse those options that way, despite defining them that way. So I'm pretty convinced this is a bug in the default
--ansi
option definition, and we shouldn't be using negatable like this.Anyway, it looks like that change will be reverted until Symfony 6.0 because it also caused backwards compatibility breaks (as it did for us), so we can fight that fight later 😛
In the meantime, specifying
--color
or--ansi
to force the color on should work!Seems like this is also a result of https://github.com/symfony/symfony/pull/39642? Anyway, thanks for investigating this @bobthecow.
Cool. So this will be fixed in the next round of patch releases to the symfony console component?
@GrahamCampbell the PR @bobthecow linked to isn't merged yet.
Since this is now closed, while i personally think it should be open while we keep track of it and until it gets fixed here's a simple quickfix for people encountering this. Simply run tinker like this:
php artisan tinker --ansi
- this forces the color output :)Thanks work like a charm !
Wait, are you saying you edited that file in your vendor folder?
:trollface:
it works @niladam Thank you
Thanks! Some change now (2021)