Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

At some point, I started getting a message about 311 characters of unexpected output at every plugin activation. The number is always the same, and it happens for every plugin activation, including reactivating plugins that were temporarily deactivated.

The exact message:

The plugin generated 311 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.

Is this likely to be a problem with a plugin that has extra whitespace in its files or something? I haven't yet gotten any problems with headers already having been sent. Possibly it's related to the weird 404 errors I get in wp-admin, but that problem was around long before this unexpected output issue.

share|improve this question
    
Could you quote error message exactly? –  Rarst Sep 29 '10 at 5:59
    
Added exact error message. –  dgw Sep 30 '10 at 22:49

1 Answer 1

up vote 1 down vote accepted

Basically it goes like this (relevant steps only):

  1. plugins.php page calls activate_plugin() function.
  2. Function starts output buffering.
  3. Includes plugin file.
  4. Fires activate_plugin action.
  5. Fires 'activate_' . trim( $plugin ) action.
  6. Fires activated_plugin action.
  7. If buffer is not empty it creates WP_Error object and returns it.
  8. plugins.php page checks for error and displays error message.

So output happens somewhere between steps 2 and 7. If it comes up for multiple plugins then steps 3 and 5 are safe to exclude, they are plugin-specific.

So it is likely something in either activate_plugin or activated_plugin. Also actual unwanted output is passed in WP_Errorobject but not used (only its length).

I'd try to dump hooks first, will take bit of extra code in core a bit to get to that output in WP_Error object.

share|improve this answer
    
Thanks, Rarst. Problem solved. Dumping hooks using the old (but still usable) System Information plugin led me to the activated_plugin hook. PuSHPress was running code on every activation and causing trouble. I'll report the issue in the plugin's forums. Your pointer is much appreciated! –  dgw Oct 5 '10 at 21:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.