Development

#2926 ([PATCH] controller->getPresentationFor()/sendEmail fails when exception is thrown)

You must first sign up to be able to contribute.

Ticket #2926 (reopened defect)

Opened 10 months ago

Last modified 5 months ago

[PATCH] controller->getPresentationFor()/sendEmail fails when exception is thrown

Reported by: gnat Assigned to: Carl.Vondrick
Priority: minor Milestone: 1.0.12
Component: controller Version: 1.1.0 DEV
Keywords: Cc:
Qualification: Ready for core team

Description

When using the function sendEmail() any exception thrown such as when the email is invalid or smtp connection errors, the render mode isn't reset, and thus you get a white screen, no content whatsoever. Instead a try / catch block around the $this->forward action with a catch to reset the render mode and then throw the exception allows the calling method to handle the exception properly and still continue if desired. as I really don't know what else this function does, all I can say is it works for me. Patch included.

Attachments

controller.patch (0.7 kB) - added by gnat on 02/13/08 08:05:27.
fixe missing try/catch
controller.php.php (1.0 kB) - added by Carl.Vondrick on 03/14/08 06:53:01.
controller11.php.patch (0.9 kB) - added by Carl.Vondrick on 03/14/08 06:57:17.
patch for 1.1
sfController.patch (1.0 kB) - added by gnat on 06/02/08 22:46:51.
fixes exception handling in getPresentationFor
DryController.patch (1.6 kB) - added by Carl.Vondrick on 07/14/08 00:11:27.
A modified version of the patch that is DRY

Change History

02/13/08 08:05:27 changed by gnat

  • attachment controller.patch added.

fixe missing try/catch

02/27/08 05:03:48 changed by gnat

  • version changed from 1.0.11 to 1.1.0.

this also affects 1.1...

03/14/08 06:53:01 changed by Carl.Vondrick

  • attachment controller.php.php added.

03/14/08 06:57:17 changed by Carl.Vondrick

  • attachment controller11.php.patch added.

patch for 1.1

03/14/08 06:58:19 changed by Carl.Vondrick

  • priority changed from major to minor.
  • qualification changed from Unreviewed to Ready for core team.
  • summary changed from controller->getPresentationFor()/sendEmail fails when exception is thrown to [PATCH] controller->getPresentationFor()/sendEmail fails when exception is thrown.

Patches for 1.0 and 1.1 attached. I think the cleanup should also fix the view name.

03/19/08 19:01:30 changed by fabien

  • milestone set to 1.0.12.

I think, you can commit the fix. Thanks.

03/19/08 19:27:15 changed by gnat

are you speaking to Carl, or myself? I only have commit privs on /plugins

03/19/08 20:14:35 changed by Carl.Vondrick

  • owner changed from fabien to Carl.Vondrick.
  • status changed from new to assigned.

I will commit today.

03/20/08 01:19:19 changed by Carl.Vondrick

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [7992]) 1.1: fixed controller->getPresentationFor() fails when exception is thrown (closes #2926)

03/20/08 01:21:51 changed by Carl.Vondrick

And r7993

06/02/08 22:46:19 changed by gnat

  • status changed from closed to reopened.
  • resolution deleted.

It now fails in another way. When an exception is thrown from the sendEmail function, you loose all variables in the action that called $this->sendEmail();

I can provide a test showing the behaviour if need be, however the newly attached patch fixes the behaviour for me.

06/02/08 22:46:51 changed by gnat

  • attachment sfController.patch added.

fixes exception handling in getPresentationFor

06/23/08 03:19:53 changed by dwhittle

  • status changed from reopened to closed.
  • resolution set to fixed.

This is fixed in 1.0 + 1.1.

06/23/08 04:58:38 changed by gnat

I'm not sure how it is fixed, I just looked at the 1.0 branch, and the code will still fail. I attached a patch that showed the action stack needing to be reversed as well... Was that applied?

06/23/08 08:48:18 changed by fabien

  • status changed from closed to reopened.
  • resolution deleted.

07/11/08 03:31:03 changed by Carl.Vondrick

What is the status for this ticket?

07/11/08 04:53:06 changed by gnat

It still needs my final attached patch of sfController.patch (1.0 kB) - added by gnat on 06/02/08 22:46:51. applied to fully function. If throws an execption you get the right render mode back, but lose variables values in the original function which called sendEmail(). If you want I can get 1.0 trunk and run the test suite with my patch attached to verify that there are no regressions. Or I can add a test case demonstrating the issue. Just let me know, as it stands I have a few projects I'm overloading the core controller class to behave properly...

07/14/08 00:11:27 changed by Carl.Vondrick

  • attachment DryController.patch added.

A modified version of the patch that is DRY

07/14/08 00:12:48 changed by Carl.Vondrick

I've created a modified version of your patch, gnat, and have attached it for review.

It accomplishes the same as yours, but tries to stay DRY. (PHP needs a finally construct...)