-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[2.5][Console] Use of undefined constant STDIN - assumed 'STDIN' #10795
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
Comments
ping @romainneutron |
Hello, this is not a [Process] issue but a [Console] issue (@fabpot or @jakzal could you update the tag?). Anyway, I've checked and there is no difference between version 2.4 and 2.5 of DialogHelper (that use You can however inject your own inputStream using |
If it worked in 2.4 and does not work in 2.5 that is a breaking change / bug, no?— On Mon, Apr 28, 2014 at 5:44 AM, Romain Neutron [email protected]
|
Sorry, I updated the title. I was talking about the QuestionHelper, not DialogHelper. QuestionHelper is new in 2.5, right? DialogHelper isn't causing problems, because it doesn't get to a point where it actually uses STDIN. QuestionHelper hower, uses STDIN in its constructor, which is called in the getDefaultHelperSet() Setting the InputStream doesn't help, because the problem isn't that the InputStream doesn't work, the problem is dat it doesn't recognize the STDIN constant. |
Testcase, with only requiring symfony/console:
When I require "symfony/console": "2.4.x", this runs fine. When I require 2.5.x: |
… when STDIN is not declared (romainneutron) This PR was merged into the 2.5-dev branch. Discussion ---------- [Console] Fix #10795: Allow instancing Console Application when STDIN is not declared | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #10795 | License | MIT Commits ------- 3a5a525 [Console] Fix #10795: Allow instancing Console Application when STDIN is not declared
Thanks! |
The new Console QuestionHelper uses the constant
STDIN
which is only available when using PHP in CLI modus. This is usually fine for the console, but in some cases command's are called through the web php.This worked in 2.4, but doesn't work in 2.5, even when not using the QuestionHelper, because the QuestionHelper is instantiated in the Console Application getDefaultHelperSet(), and the STDIN constant is used in the constructor.
Cases where this lead to errors:
(But both are probably not best practices, but I came across both when testing Laravel 4.2-dev, which uses Symfony 2.5)
Possible fixes:
define('STDIN',fopen("php://stdin","r"));
), can prevent errors in the rest of the helpers also, but probably don't have the desired effect.)(cc @taylorotwell for Laravel)
The text was updated successfully, but these errors were encountered: