-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Constant STDOUT might be undefined #34344
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
Conversation
derrabus
commented
Nov 12, 2019
•
edited by chalasr
Loading
edited by chalasr
Q | A |
---|---|
Branch? | 3.4 |
Bug fix? | yes |
New feature? | no |
Deprecations? | no |
Tickets | Fix #34341 |
License | MIT |
Doc PR | N/A |
1b564cb
to
dd79978
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fopen('php://stdout', 'w')?
Would be overkill here. The constant is defined by the CLI SAPI. Thus, if the constant is not there, we're not on CLI, thus we're not on a terminal with VT100 support. We already have a similar check in PhpUnitBridge: symfony/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php Lines 355 to 357 in fb4065a
|
I'm not sure I agree. If the check targets the sapi, let's make it crystal clear. Checks for color support all use php://stdout. STDOUT is not used anywhere else in the codebase as far as I checked. I think we should check what we want to check in a portable way, using php://stdout Sorry my previous comment was too laconic. |
Well yes, the method I've linked in my previous comment uses the constant to check for color support as well. symfony/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php Lines 353 to 383 in fb4065a
Also, I wouldn't want to change the way stdout is accessed without a Windows machine to test on. 😕 |
That's the bridge, it's not a piece of reusability, it's a tool :) |
dd79978
to
e1bfb48
Compare
All right, here you go. @lazosweb Can you please test again? Sorry for the hassle. 😃 |
@derrabus . All good. No issue. That will work too. |
Should be merged after #34346 and rebased on 3.4. |
e1bfb48
to
4225009
Compare
4225009
to
bb8c82c
Compare
This PR was merged into the 3.4 branch. Discussion ---------- [Console] Constant STDOUT might be undefined | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #34341 | License | MIT | Doc PR | N/A Commits ------- bb8c82c [Console] Constant STDOUT might be undefined.
Thank you @derrabus |