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

[6.x] Use of undefined constant STDOUT #30571

Closed
lazosweb opened this issue Nov 12, 2019 · 6 comments
Closed

[6.x] Use of undefined constant STDOUT #30571

lazosweb opened this issue Nov 12, 2019 · 6 comments

Comments

@lazosweb
Copy link

lazosweb commented Nov 12, 2019

  • Laravel Version: 6.5.1
  • PHP Version: 7.3.11
  • Database Driver & Version:
  • OS: Windows Server 2016
  • IIS: 10

Description:

Symfony Console 4.3.7 introduced a new method to return whether STDOUT has vt100 support (some Windows 10+ configurations)

When calling from a controller Artisan::call("demo:command");

This method errors with the following "Use of undefined constant STDOUT - assumed 'STDOUT' (this will throw an Error in a future version of PHP)"

Steps To Reproduce:

Call an artisan command from a controller on a Windows 2016 Server and IIS 10.

@lazosweb lazosweb changed the title Use of undefined constant STDOUT [5.8] Use of undefined constant STDOUT Nov 12, 2019
@driesvints
Copy link
Member

Hey there,

Unfortunately we don't support this version anymore. Please check out our support policy on which versions we are currently supporting. Can you please try to upgrade to the latest version and see if your problem persists? We'll help you out and re-open this issue if so.

Thanks!

@lazosweb
Copy link
Author

lazosweb commented Nov 12, 2019

@driesvints

I created a sample Laravel 6 project and run a simple built in command such as "cache:clear" and the problem persists even in Laravel 6.

See attached photo.

Screenshot_2019-11-12 🧨 Use of undefined constant STDOUT - assumed 'STDOUT' (this will throw an Error in a future version

@lazosweb lazosweb changed the title [5.8] Use of undefined constant STDOUT [6.x] Use of undefined constant STDOUT Nov 12, 2019
@mfn
Copy link
Contributor

mfn commented Nov 12, 2019

STDOUT is only defined for CLI, not in web server SAPIS.

As such, calling console commands from within a web server will not work anymore with this change from Symfony.

It's possible to shim the constant, google gives you workarounds for that.

Hard to say who's at fault:

  1. why do you call a console command from within a web server?
  2. why does Laravel not provide such a shim out of the box (of course because this is new, etc.)
  3. why didn't the Symfony developers take the absence of this constant into account (probably same answer as 1) … )

The easiest way is simply to not do that. If you have code you need to execute, refactor it so you can call it directly or use a background job 🤷‍♀️

@lazosweb
Copy link
Author

lazosweb commented Nov 12, 2019

@mfn I see your point.

  1. Since Laravel provides us with a way to execute a command programmatically I do not see the point why not to.

  2. I guess you are right about that one. I do not thing Symfony console was meant to be called from the web server. Some Symfony examples I saw online are call from the command line.

@lazosweb
Copy link
Author

Symfony will fix this bug. I do not know if Laravel has to do anything from their end until they release a bug fix.

symfony/symfony#34344

@mfn
Copy link
Contributor

mfn commented Nov 13, 2019

Nothing to be done for Laravel. Users hitting this problem can pin an older Symfony version for that package until this is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants