Another bug report
Ticket is here.
When using a custom 404 module/action, calling sfController::forward() or sfController::redirect() or any other part of symfony that results in an sfStopException being thrown, this exception will not be caught and thus result in a fatal error. The same is true for all other exceptions as well, but I'm highlighting sfStopExceptions because they are part of symfony's normal operation and it can be reasonably expected they be caught.
Analysis:
The forward to the 404 action happens inside the printStackTrace() method of the sfError404Exception that is throw and immediately caught in sfFrontWebController::dispatch(). There are no try-catch blocks around either the forward() call nor the printStackTrace call to catch exceptions that are throw as part of symfony's normal operation, or any exceptions for that matter.
Stack trace:
PHP Fatal error: Uncaught exception 'sfStopException' in /var/www/promotions/current/cache/frontend/prod/config/config_core_compile.yml.php:294
Stack trace:
#0 /var/www/promotions/current/apps/frontend/modules/error/actions/actions.class.php(19): sfAction->redirect('http://…', 404)
#1 /var/www/promotions/current/cache/frontend/prod/config/config_core_compile.yml.php(462): errorActions->executeError404(Object(sfWebRequest))
#2 /var/www/promotions/current/cache/frontend/prod/config/config_core_compile.yml.php(1109): sfActions->execute(Object(sfWebRequest))
#3 /var/www/promotions/current/cache/frontend/prod/config/config_core_compile.yml.php(1104): sfExecutionFilter->executeAction(Object(errorActions))
#4 /var/www/promotions/current/cache/frontend/prod/config/config_core_compile.yml.php(1093): sfExecutionFilter->handleAction(Object(sfFilterChain), Object(errorActions))
#5 /var/www/promotions/current/cache/frontend/prod/config/config_core_compile.yml.php(1189): sfExecutionFilter->execute(Object(sfFilterChain))
#6 /var/www/promotions/current/cache/frontend/prod/config/config_core_compile.yml.php(1051): sfFilterChain->execute()
#7 /var/www/promotions/current/cache/frontend/prod/config/config_core_compile.yml.php(1189): sfCommonFilter->execute(Object(sfFilterChain))
#8 /var/www/promotions/current/cache/frontend/prod/config/config_core_compile.yml.php(1152): sfFilterChain->execute()
#9 /var/www/promotions/current/cache/frontend/prod/config/config_core_compile.yml.php(1189): sfRenderingFilter->execute(Object(sfFilterChain))
#10 /var/www/promotions/current/cache/frontend/prod/config/config_core_compile.yml.php(734): sfFilterChain->execute()
#11 /var/www/promotions/current/lib/symfony/exception/sfError404Exception.class.php(49): sfController->forward('error', 'error404')
#12 /var/www/promotions/current/cache/frontend/prod/config/config_core_compile.yml.php(2530): sfError404Exception->printStackTrace()
#13 /var/www/promotions/current/lib/symfony/util/sfContext.class.php(164): sfFrontWebController->dispatch()
#14 /var/www/promotions/current/web/index.php(9): sfContext->dispatch()
#15 {main}
thrown in /var/www/promotions/current/cache/frontend/prod/config/config_core_compile.yml.php on line 294Possible solutions:
One way to solve this problem would be to move the forward out of the printStackTrace() method since that strikes me as a weird place to put it in the first place. The other solution would be to place another try-catch block around either the forward or the printStackTrace() call to ensure that normal symfony behavior can occur without causing a fatal error.