10000 [Twig Bridge] A simpler way to retrieve flash messages by javiereguiluz · Pull Request #21819 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Twig Bridge] A simpler way to retrieve flash messages #21819

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

Closed
wants to merge 10 commits into from
Prev Previous commit
Next Next commit
Fixed code syntax
  • Loading branch information
javiereguiluz committed Mar 1, 2017
commit e05144d24b494af3eedfdc565c41a5f6b548470c
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/AppVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function getFlashes()
if (null !== $session && !$session->isStarted()) {
return array();
}
} catch(\RuntimeException $e) {
} catch (\RuntimeException $e) {
Copy link
Contributor
@ro0NL ro0NL Mar 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be too broad, only to bypass The "app.session" variable is not available.. I guess it's an edge case :) but maybe do a quick return array() as well if there's no request stack and drop the try/catch.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes ... it's tricky. But avoiding the try...catch would require to duplicate some of the code of this very same class.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would check requestStack here, and rely on getSession to be available otherwise.

return array();
}

Expand Down
0