Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#14410 closed defect (bug) (invalid)

Unexpected output incorrectly reported during plugin activation

Reported by: chmac's profile chmac Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: General Keywords: reporter-feedback
Focuses: Cc:

Description

When I activate the WP Mail SMTP plugin, I get the following error:
The plugin generated 194 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.

Other users have reported the same error with different numbers of characters. I've checked, double checked and checked again the plugin code, and I can't see anything outside of the PHP tags or any output functions called during activation. I think the issue has to lie somewhere else, unfortunately I've no idea where.

Plugin code is available here:

Change History (7)

#1 @westi
14 years ago

  • Keywords reporter-feedback added

This is the error I see if I capture and output the error message:

Fatal error: Cannot redeclare wp_mail_plugin_action_links() (previously declared in /Users/peterwestwood/Sites/trunk.domain/public/wp-content/plugins/wp-mail-smtp/wp_mail_smtp.php:427) in /Users/peterwestwood/Sites/trunk.domain/public/wp-content/plugins/wp-mail-smtp/wp_mail_smtp.php on line 436

#2 @nacin
14 years ago

It looks like it is the only function that isn't already wrapped in a function_exists(). Not sure why it would get included twice -- perhaps you have another plugin that also uses that function?

Also, a suggestion (as a faithful user of this plugin on a multisite install). For your WPMS_ON constant, it would be better to simply rely on is_multisite() where appropriate, and also is_plguin_active_for_network() where appropriate, as we now have both in 3.0 and it is much easier to identify when a plugin is activated network-wide now.

#3 follow-up: @chmac
14 years ago

@westi: Thanks for sharing that, I really appreciate it.

@nacin: I'm also puzzled as to why the function is being created twice. Could there be something whereby WordPress is including the file twice maybe? I'm guessing wrapping that function in an if(!function_exists()) would resolve the issue, but it seems like a hack rather than a solution.

I'll look into the is_multisite() and is_plugin_active_for_network() functions you mentioned. My guess is that WPMS_ON does something slightly different, disabling the admin page and pulling the settings from constants, but maybe I've misunderstood what you've suggested. Would you like to post something so we can continue the discussion here:
http://www.callum-macdonald.com/2008/12/12/wp-mail-smtp-v08/

#4 in reply to: ↑ 3 @nacin
14 years ago

Replying to chmac:

I'll look into the is_multisite() and is_plugin_active_for_network() functions you mentioned. My guess is that WPMS_ON does something slightly different, disabling the admin page and pulling the settings from constants,

Nope, I forgot how it worked. Thanks.

#5 @nacin
14 years ago

Callum, can you try this again on trunk? I think we fixed this issue.

#6 @ocean90
14 years ago

With trunk and 3.0.1 I get this error message

[08-Jan-2011 23:12:38] PHP Warning:  Invalid argument supplied for foreach() in /wp-content/plugins/wp-mail-smtp/wp_mail_smtp.php on line 86

#7 @dd32
14 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

The plugin is outputting a PHP Notice upon being activated. This function is working as expected.

Note: See TracTickets for help on using tickets.