Better capabilities surrounding console notFoundAction #3254

Merged
merged 3 commits into from Dec 19, 2012

Projects

None yet

4 participants

@weierophinney
Member
@weierophinney weierophinney Better capabilities surrounding console notFoundAction
- Return a console response for non-HTTP response types; resolves comment noted
  in zendframework/zendframework#3186
1682874
@akrabat akrabat commented on an outdated diff Dec 19, 2012
library/Zend/Mvc/Controller/AbstractActionController.php
if ($response instanceof HttpResponse) {
- $response->setStatusCode(404);
+ $viewModel = $this->createHttpNotFoundModel($response);
+ }
+ if (!$response instanceof HttpResponse) {
@akrabat
akrabat Dec 19, 2012 Member

This should be } else {

@akrabat akrabat commented on an outdated diff Dec 19, 2012
...ry/Zend/Mvc/View/Console/DefaultRenderingStrategy.php
@@ -91,7 +90,12 @@ public function render(MvcEvent $e)
}
// Fetch result from primary model
- $responseText .= $result->getResult();
+ if ($result instanceof ConsoleViewModel) {
+ $responseText .= $result->getResult();
+ }
+ if (!$result instanceof ConsoleViewModel) {
@akrabat
akrabat Dec 19, 2012 Member

Should be } else {

@akrabat akrabat added a commit that referenced this pull request Dec 19, 2012
@akrabat akrabat Merge branch 'hotfix/3254' into develop
Forward port #3254
3d41fed
@akrabat akrabat added a commit that referenced this pull request Dec 19, 2012
@akrabat akrabat Merge branch 'hotfix/3254'
Clost #3254
9514fa4
@akrabat akrabat merged commit bd5913c into zendframework:master Dec 19, 2012

1 check failed

default The Travis build failed
Details
@akrabat akrabat was assigned Dec 19, 2012
@weierophinney weierophinney deleted the weierophinney:hotfix/console-404 branch Dec 19, 2012
@ThomasCantonnet
Contributor

@weierophinney @akrabat this fix triggers yet another error on any console request:

PHP Catchable fatal error: Argument 1 passed to Zend\Mvc\ResponseSender\ConsoleResponseSender::sendContent() must be an instance of Zend\Mvc\ResponseSender\SendResponseEvent, instance of Zend\Console\Response given, called in library/Zend/Mvc/ResponseSender/ConsoleResponseSender.php on line 49 and defined in library/Zend/Mvc/ResponseSender/ConsoleResponseSender.php on line 28

@weierophinney
Member

One note: the issue @H3DAZ brings up is only true when routing via the console to actions that do not exist; I'm using console actions with current master fine with no issues.

@ThomasCantonnet
Contributor

@weierophinney although on develop this bug seems to be on every action existing or not. Fixed with PR #3263

@nhaze
nhaze commented Dec 22, 2012

I get the same error as H3DAZ without any routers and simply using the console banner to test the console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment