WordPress.org

Making WordPress.org

#3051 closed defect (fixed)

phpunit-test-reporter: Properly avoid a conflict with P2's welcome_box()

Reported by: SergeyBiryukov Owned by: danielbachhuber
Milestone: Priority: normal
Component: Make (Get Involved) / P2 Keywords: has-patch
Cc:

Description

[5808] appears to be an attempt to avoid a conflict between phpunit-test-reporter plugin's filter_the_content() method and the theme's welcome_box() function.

[5813] reverted that change, as it caused #3047.

[5814] was another attempt, however there's no need to alter the theme files for that at all, the plugin could just check ! did_action( 'wporg_breathe_after_header' ) instead and return early.

cc @danielbachhuber

Attachments (2)

3051.patch (1.4 KB) - added by SergeyBiryukov 21 months ago.
3051.2.patch (1.4 KB) - added by SergeyBiryukov 21 months ago.

Download all attachments as: .zip

Change History (7)

#1 follow-up: @danielbachhuber
21 months ago

@SergeyBiryukov Thanks for the feedback.

phpunit-test-reporter is a generic WordPress plugin, so I'd prefer to not include any WPorg-specific code in it.

Because the scope of the problem is the welcome box, I thought it more appropriate to put the modification in wporg-breathe.

Another option would be to create a make/hosting-specific plugin that includes these sorts of modifications but I thought that'd be overkill for the immediate need.

#2 in reply to: ↑ 1 @SergeyBiryukov
21 months ago

Replying to danielbachhuber:

phpunit-test-reporter is a generic WordPress plugin, so I'd prefer to not include any WPorg-specific code in it.

Makes sense, thanks for the clarification.

However, I've seen some themes applying the_content filter before the WP loop starts, e.g. to display Open Graph tags, meta description, etc. So the same issue can occur in other themes, not just in Breathe.

3051.2.patch uses a generic loop_start action to make sure the plugin only filters content once the loop has started.

#3 follow-up: @danielbachhuber
21 months ago

+1 to using loop_start

Can you commit and deploy 3051.2.patch, and then I'll port the change to the plugin if it proves to be a successful approach?

After deploying, you'll want to check https://make.wordpress.org/hosting/test-results/r41255/dhdreampressbot-r41255/ to make sure the test results aren't ending up in the welcome message.

#4 in reply to: ↑ 3 @SergeyBiryukov
21 months ago

Replying to danielbachhuber:

Can you commit and deploy 3051.2.patch, and then I'll port the change to the plugin if it proves to be a successful approach?

Only have commit for the support-forums plugin and theme, sorry :)

#5 @danielbachhuber
21 months ago

  • Owner set to danielbachhuber
  • Resolution set to fixed
  • Status changed from new to closed

In 5823:

phpunit-test-reporter: Use more precise filtering

Props SergeyBiryukov
Fixes #3051

Note: See TracTickets for help on using tickets.