Bug #30935

Catch ViewHelper exceptions and log them in production context

Added by Bastian Waidelich over 1 year ago. Updated over 1 year ago.

Status:Resolved Start date:2011-10-14
Priority:Should have Due date:
Assignee:Christian Mueller % Done:

100%

Category:Core
Target version:-
Has patch:No FLOW3 version affected:FLOW3 1.0.0
Votes: 0

Description

from line 241 of the AbstractViewHelper:

1 try {
2     return call_user_func_array(array($this, 'render'), $renderMethodParameters);
3 } catch (\TYPO3\Fluid\Core\ViewHelper\Exception $exception) {
4     // @todo [BW] rethrow exception, log, ignore.. depending on the current context
5     return $exception->getMessage();
6 }

As the todo comment states, this should be caught in production context and logged to prevent information disclosure.
Code could look something like:

 1 try {
 2     return call_user_func_array(array($this, 'render'), $renderMethodParameters);
 3 } catch (\TYPO3\Fluid\Core\ViewHelper\Exception $exception) {
 4     if ($this->objectManager->getContext() === 'Development') {
 5         return $exception->getMessage();
 6     } else {
 7         $this->systemLogger->log([...]);
 8         return '';
 9     }
10 }


Related issues

related to Fluid - Bug #32528: imageViewHelper should not throw exception New 2011-12-14
duplicates TYPO3.Fluid - Feature #9211: Improve ViewHelper exception handling Rejected 2010-08-09

Associated revisions

Revision 5fa13298
Added by Christian Mueller over 1 year ago

[BUGFIX] ViewHelper Exceptions should be logged in Production

In Production context all Exceptions from ViewHelpers will be
silently logged. In Development they will be re-thrown so the global
exception handler will be triggered.

Resolves: #30935
Releases: 1.1
Change-Id: I4af4d03ff6048fcc8999f4a48d5c2897dc43fc4e

History

Updated by Mr. Hudson over 1 year ago

Patch set 2 of change I4af4d03ff6048fcc8999f4a48d5c2897dc43fc4e has been pushed to the review server.
It is available at http://review.typo3.org/5808

Updated by Christian Mueller over 1 year ago

  • Status changed from New to Under Review
  • Assignee set to Christian Mueller

Updated by Karsten Dambekalns over 1 year ago

  • FLOW3 version affected set to FLOW3 1.0.0

Updated by Mr. Hudson over 1 year ago

Patch set 3 of change I4af4d03ff6048fcc8999f4a48d5c2897dc43fc4e has been pushed to the review server.
It is available at http://review.typo3.org/5808

Updated by Mr. Hudson over 1 year ago

Patch set 4 of change I4af4d03ff6048fcc8999f4a48d5c2897dc43fc4e has been pushed to the review server.
It is available at http://review.typo3.org/5808

Updated by Christian Mueller over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF