Make WordPress Core

Opened 21 years ago

Closed 21 years ago

#649 closed defect (bug) (fixed)

Custom 'Options' pages for plugins display duplicate content

Reported by: morganiq's profile morganiq Owned by: kitten's profile Kitten
Milestone: Priority: normal
Severity: minor Version: 1.5
Component: Administration Keywords:
Focuses: Cc:

Description

The 'Options' pages of plugins such as Kitten's Spaminator and Geo (which are the only plugins I know of at the moment that use custom Options pages) display duplicates of:

  • The custom page content generated by the plugin.
  • The custom submenu item for the plugin.

Note that the custom submenu item is only duplicated when a plugin Options page is selected. However, if other plugins are installed, their submenu items are duplicated as well.

Attachments (6)

plugin-options-screenshot-2.png (172.1 KB) - added by morganiq 21 years ago.
plugin-options-screenshot-3.png (145.1 KB) - added by morganiq 21 years ago.
plugin-options-screenshot-4.png (109.3 KB) - added by morganiq 21 years ago.
plugin-options-screenshot.png (171.4 KB) - added by morganiq 21 years ago.
options-fix.diff (331 bytes) - added by morganiq 21 years ago.
plugin-options-fix.diff (331 bytes) - added by morganiq 21 years ago.

Download all attachments as: .zip

Change History (30)

#1 @morganiq
21 years ago

  • Patch set to No
  1. Download and install Kitten's Spaminator http://dev.wp-plugins.org/file/spaminator/trunk/kittens-spaminator.php?rev=168&format=txt and/or Geo http://dev.wp-plugins.org/file/geo/trunk/geo.php?rev=102&format=txt
  2. Remove the last newline in each to eliminate "Headers already sent" errors, then activate the plugins.
  3. In the Admin panel, click 'Options' from the menu, then 'Geo Info' and/or 'Spaminator' from the submenu

#2 @2fargon
21 years ago

  • Owner changed from anonymous to Kitten
  • Severity changed from major to minor
  • Status changed from new to assigned

Kitten, Is this a plugin-problem?

#3 @morganiq
21 years ago

Oops, ignore step 2 in "Steps to Reproduce" above. Forgot that I had copy & pasted the plugins, so the errors were my doing. Silly me.

#4 @2fargon
21 years ago

morganiq: where are the steps to reproduce anyways? :)

Do you mean to say this is not an issue anymore, or does the issue persist?

#5 @morganiq
21 years ago

No, this is still an issue. Only Step 2 should not have been included, because that was an issue I caused.

Steps to Reproduce are in Advanced view. Click "View Advanced" in the upper-right corner of the Issue Details.

#6 @morganiq
21 years ago

I've done some more exploring. I'm now convinced this is a bug in WordPress, not an issue with the plugins themselves.

edited on: 01-09-05 19:28

#7 @morganiq
21 years ago

I've isolated it to this change by rboren Tue Oct 19: http://cvs.sourceforge.net/viewcvs.py/cafelog/wordpress/wp-admin/admin-header.php?r1=1.34&r2=1.35

Reverting the change above fixes this issue, but would reopen #393.

#8 @2fargon
21 years ago

Maybe the plugins need to be updated to conform to the change in the scheme of things. Can you contact the plugin authors please?

#9 @midrangeman
21 years ago

I notice the same behavior when using Kitten's Spaminator plugin options tab. Of course the Spaminator options tab doesn't currently do anything yet :).

#10 @morganiq
21 years ago

[2fargon:] Maybe the plugins need to be updated to conform to the change in the scheme of things.

I'm not sure which way you mean this, because #393 relates to plugins that need to be updated as well. But if you mean that the plugins I mention above under Steps to Reproduce should be changed to fix this issue, there's no way the plugins themselves can correct this behavior; it has to be corrected within WordPress. The change I mentioned in my previous bugnote was what caused the behavior, but I'm sure Ryan or Kitten can come up with a fix that will solve both this issue and #393 satisfactorily.

[2fargon:] Can you contact the plugin authors please?

Were you talking to me with this? 'Cause Kitten's one of 'em, and she's been assigned this bug. I can contact Owen if you want, but like I said, he can't do anything to correct this issue within the plugin itself.

#11 @morganiq
21 years ago

Just wanted to point out that Mantis is mistakenly including the right-brackets in the auto-links in Steps to Reproduce above. You'll have to remove the right-bracket from the end of the links to view the plugin sources.

#12 @Kitten
21 years ago

I've updated spaminator (rev. 174) to "work around" this problem, by wrapping the problem call in a "! function_exists" wrapper.

Basically this is happening because the plugins are loaded by WP's core, then the plugin file itself is called again to show the page. It wouldn't be a problem if I wanted to make the admin page a seperate file. But that would make it a more complicated install, and 2 files to version, etc.

The function_exists trade off is inelegant, but suitable in this instance.

In the future, problems of this nature should be reported in the plugins repository, ( http://dev.wp-plugins.org/newticket ) because it is a plugin bug not a WP issue.

I'm going to close this bug, if the reporter concurs, he can resolve it.

edited on: 01-10-05 02:53

#13 @Kitten
21 years ago

  • Resolution changed from 10 to 20
  • Status changed from assigned to closed

#14 @morganiq
21 years ago

  • Resolution changed from 20 to 30
  • Status changed from closed to assigned

Kitten: That's not the issue this bug refers to. (I corrected that in my local copy of Spaminator as soon as I saw it, but I should've probably mentioned it in Steps to Reproduce above.) You fixed something different.

This bug refers to the duplication of content on the Options pages. I updated to your new revision of Spaminator (which made the same change I did previously to my local copy), and this bug is still present.

I think you'll find that this is in fact an issue with WordPress, and cannot be fixed by changing the plugin itself. This issue would appear to be caused by cyclical includes between admin.php and admin-header.php.

See the screenshots attached to this bug for a visual illustration of the bug.

Reopening.

#15 @morganiq
21 years ago

One additional note: admin-footer.php is duplicated as well. It's not just the plugin content.

#16 @morganiq
21 years ago

Attached another screenshot (plugin-options-screenshot-3.png) showing Spaminator (the latest version) exhibiting the behavior in question.

#17 @Kitten
21 years ago

Ok, you've found a Safari bug most likely. Firefox on linux does not do that. Don't know what to do about it, since I don't have a Mac.

Another thought, do a fresh CVS checkout in another directory, and install spaminator and see if it still does it.

edited on: 01-10-05 04:36

#18 @ryan
21 years ago

Very odd. Sounds like require_once() is not doing its job, or something.

edited on: 01-10-05 04:38

#19 @morganiq
21 years ago

[Kitten:] Ok, you've found a Safari bug most likely. Firefox on linux does not do that. Don't know what to do about it, since I don't have a Mac. Another thought, do a fresh CVS checkout in another directory, and install spaminator and see if it still does it.

I've attached plugin-options-screenshot-4.png, a picture of the same behavior in Firefox 1.0 on a fresh CVS install.

[rboren:] Very odd. Sounds like require_once() is not doing its job, or something.

The code that inserts the content in question uses only include(), not include_once() or require_once() (see lines 55 and 57 of wp-admin/admin.php). Apparently somehow with the cyclical dependencies those are in fact being executed twice.

Are you able to reproduce this issue, Ryan?

#20 @ryan
21 years ago

I meant the require_once on admin.php from the various admin pages. I cannot reproduce with any of the plugins that add admin pages, including Spaminator. I'll look around some more.

#21 @morganiq
21 years ago

A cursory search through the PHP 4 Changelog (http://www.php.net/ChangeLog-4.php) doesn't appear to show any require_once() bugfixes since my PHP version (4.2.2).

Ryan: What PHP version are you running, and on what platform?

#22 @morganiq
21 years ago

I've added a diff of a simple change which fixes the problem for me.

I don't know if it'll cause regression with respect to #393 though -- Ryan?

#23 @morganiq
21 years ago

Both diffs are the same; I uploaded another because my browsers were handling the first one oddly -- but the second is being handled just as oddly, so I'll just forget about it.

#24 @midrangeman
21 years ago

morganiq: I applied your patch and it solved the duplicated content without effecting 393.

#25 @morganiq
21 years ago

Thanks, good to know midrangeman. Just out of curiosity, what version of PHP are you running?

I'm just about to update to PHP 4.3.8 to fix a separate issue that I know to have been fixed in 4.3.0, but I'm curious to see if this behavior changes as well with the update. I'll post again here to let you know what happens.

#26 @midrangeman
21 years ago

I'm running PHP 4.1.2 on a stock Redhat 7.3 install.

#27 @gbhugo
21 years ago

Just a note that I had the same problem and the patch did fix it. In my case it's PHP 4.1.2 on Debian stable.

#28 @ryan
21 years ago

  • fixed_in_version set to 1.5
  • Resolution changed from 30 to 20
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.