Ticket #4127 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Fatal error detection for plugin activation is too touchy

Reported by: masquerade Assigned to: rob1n
Priority: high Milestone: 2.2
Component: Administration Version: 2.2
Severity: normal Keywords: has-patch commit
Cc:

Description

If you activate a plugin which outputs anything on its activation hook (like a couple of mine used to in order to show some initial setup options, I'm sure I'm probably not the only one), you'll get a lovely message about the plugin having a fatal error, however, the plugin is still activated as normal.

Perhaps output buffer and just dump it so that the headers are properly changed and sent.

Attachments

4127.diff (0.7 kB) - added by masquerade on 04/10/07 16:10:19.

Change History

04/10/07 16:10:19 changed by masquerade

  • attachment 4127.diff added.

(follow-up: ↓ 3 ) 04/10/07 16:56:41 changed by Otto42

Regarding that patch, won't ob_end_clean() just discard the output from the plugin? If a plugin tries to output some initial setup options, this will just dump them. That may or may not be the right thing to do (plugins should probably never do output on their own), but still...

04/10/07 22:58:25 changed by JeremyVisser

-1. Plugins should technically never invalidate the XHTML by sending data before the template header (and HTTP headers), so you should have no reason to do that.

(in reply to: ↑ 1 ) 04/10/07 23:05:06 changed by masquerade

Replying to Otto42:

Regarding that patch, won't ob_end_clean() just discard the output from the plugin? If a plugin tries to output some initial setup options, this will just dump them. That may or may not be the right thing to do (plugins should probably never do output on their own), but still...

Yes, it will just dump it. That was the point. I do believe the odds of getting this reverted period are incredibly slim, its something that has been needed for a long time. Anybody (like me) who was doing weird things with output on activation has really been doing something the API wasn't intended to do in the first place (it breaks the redirect already in place to bring you back to the admin panel and all that stuff). There are other ways to handle it. I don't think just because a plugin outputs there needs to be a fatal error notice.

To Jeremy, I really don't think you know what you're talking about. That doesn't make any sense against what this ticket is about.

04/11/07 01:16:20 changed by rob1n

  • keywords changed from has-patch to has-patch commit.
  • owner changed from masquerade to rob1n.

I am +1. Makes sense, too.

04/11/07 03:22:23 changed by andy

Looks perfect. Where's my candy?

04/11/07 03:23:25 changed by rob1n

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

(In [5239]) Don't die because of output by badly-written plugins upon activation. Props masquerade. fixes #4127