-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Calling Command#getHelper() causes an error if there is no helperSet defined #18619
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
Labels
Comments
chalasr
added a commit
to chalasr/symfony
that referenced
this issue
Apr 25, 2016
…Helper() without helperSet
chalasr
added a commit
to chalasr/symfony
that referenced
this issue
Apr 25, 2016
…Helper() without helperSet
chalasr
added a commit
to chalasr/symfony
that referenced
this issue
Apr 25, 2016
…Helper() without helperSet Use Command::setHelperSet rather than Command#setHelperSet in exception msg
chalasr
added a commit
to chalasr/symfony
that referenced
this issue
May 2, 2016
…Helper() without helperSet Use Command::setHelperSet rather than Command#setHelperSet in exception msg Simplify exception message
chalasr
added a commit
to chalasr/symfony
that referenced
this issue
May 2, 2016
…Helper() without helperSet Use Command::setHelperSet rather than Command#setHelperSet in exception msg Simplify exception message Add DidYouForget to exception msg
chalasr
added a commit
to chalasr/symfony
that referenced
this issue
May 2, 2016
…Helper() without helperSet Use Command::setHelperSet rather than Command#setHelperSet in exception msg Simplify exception message Add DidYouForget to exception msg
fabpot
pushed a commit
that referenced
this issue
May 13, 2016
…) without helperSet Use Command::setHelperSet rather than Command#setHelperSet in exception msg Simplify exception message Add DidYouForget to exception msg
fabpot
added a commit
that referenced
this issue
May 13, 2016
…per without helperSet (chalasr) This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #18635). Discussion ---------- [Console] Prevent fatal error when calling Command::getHelper without helperSet | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #18619 | License | MIT | Doc PR | n/a Patch attached to #18619 Commits ------- 31285c2 [Console][#18619] Prevent fatal error when calling Command#getHelper() without helperSet
fabpot
added a commit
that referenced
this issue
May 13, 2016
* 2.3: Update HTTP statuses list [Console][#18619] Prevent fatal error when calling Command#getHelper() without helperSet Add SplFileInfo array doc on Finder iterator methods so that IDE will know what it returns [2.3] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper Updated the link to the list of currency codes
fabpot
added a commit
that referenced
this issue
May 13, 2016
* 2.7: added missing constant in Response Update HTTP statuses list [Console][#18619] Prevent fatal error when calling Command#getHelper() without helperSet added StaticVerionStrategyTest Add SplFileInfo array doc on Finder iterator methods so that IDE will know what it returns [2.3] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper Updated the link to the list of currency codes [console][table] adjust width of colspanned cell.
fabpot
added a commit
that referenced
this issue
May 13, 2016
* 2.8: Fix computation of PR diffs for component matrix lines [console][table] adjust width of colspanned cell. [BUG] Delete class 'control-group' in bootstrap 3 [2.8] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper added missing constant in Response Update HTTP statuses list [Console][#18619] Prevent fatal error when calling Command#getHelper() without helperSet added StaticVerionStrategyTest Add SplFileInfo array doc on Finder iterator methods so that IDE will know what it returns [2.3] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper Updated the link to the list of currency codes [console][table] adjust width of colspanned cell.
fabpot
added a commit
that referenced
this issue
May 13, 2016
* 3.0: Fix computation of PR diffs for component matrix lines [console][table] adjust width of colspanned cell. [BUG] Delete class 'control-group' in bootstrap 3 [2.8] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper added missing constant in Response Update HTTP statuses list [Console][#18619] Prevent fatal error when calling Command#getHelper() without helperSet added StaticVerionStrategyTest Add SplFileInfo array doc on Finder iterator methods so that IDE will 4E94 know what it returns [2.3] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper Updated the link to the list of currency codes Fixed DateTimeInterface comparaison [console][table] adjust width of colspanned cell.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
If a command contains a call to
$this->getHelper('helper')
and there is no helperSet defined, the expectedInvalidArgumentException
(that should be thrown if the helper is not defined) is not thrown because of a PHP fatal error.The error can be reproduced when testing a command with the
CommandTester
.If the command contains
$this->getHelper('question')
and is executed without callingCommand#setHelperSet(new HelperSet())
, it causes:It's a bit hard to debug because the error only say where the
get()
is called, so there is no real trace containing the original method call.Possible solution
My first thought, throw an exception in
Command#getHelper()
if there is no helperSet defined.I have a ready patch:
That gives:
Otherwise, we could define an
HelperSet
by default and so theInvalidArgumentException
would be thrown.Am I wrong when I think that this error should be prevented?
Or is there a better idea?
Thank's.
The text was updated successfully, but these errors were encountered: