Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#19913 closed defect (bug) (fixed)

multiple plugins getting "undefined function is_rtl()" under WP 3.3

Reported by: convissor's profile convissor Owned by: nacin's profile nacin
Milestone: 3.4 Priority: normal
Severity: major Version: 3.3
Component: General Keywords: has-patch
Focuses: Cc:


It seems the order of file includes has changed under WP 3.3, leading to a situation where is_rtl() is not defined in time for use by plugin administrator functionality.

Attachments (1)

19913.patch (624 bytes) - added by SergeyBiryukov 12 years ago.

Download all attachments as: .zip

Change History (7)

#1 follow-up: @duck_
12 years ago

For this particular plugin (login-lock) this is caused by wp_admin_css( 'login' );. Because the login.css styles no longer exist they aren't registered with WP_Styles. So, when wp_admin_css() tries to query() for 'login' nothing is found and the function doesn't return early and it falls through to the last three lines which print out "<link rel="stylesheet"..." and critically calls is_rtl().

So, wp_admin_css() was never safe to call this early (plugins_loaded), but the problem only emerged in 3.3 due to the merging of admin CSS files.

#2 @SergeyBiryukov
12 years ago

FWIW, I've also seen a lot of similar topics for PopUp Domination plugin. The reason was exactly the same: wp_admin_css( 'theme-editor' ).

This looks like a pure plugin issue to me. They need to be updated appropriately for WordPress 3.3.

Last edited 12 years ago by SergeyBiryukov (previous) (diff)

#3 in reply to: ↑ 1 @convissor
12 years ago

Replying to duck_:

So, wp_admin_css() was never safe to call this early (plugins_loaded),

Thank you for your excellent triage. What is the right way to include style sheets in this location, please?

#4 @nacin
12 years ago

Interesting side effect. We should consider adding a function_exists() check there. Or perhaps, as a more future-proof improvement, we should catch all handles that we used to have in WordPress, and short-circuit them across the board.

#5 @SergeyBiryukov
12 years ago

  • Keywords has-patch added; plugin 3.3 is_rtl removed
  • Milestone changed from Awaiting Review to 3.4

#6 @nacin
12 years ago

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

In [20326]:

Check for is_rtl() existence before checking it in the fallback condition in wp_admin_css(). Prevents fatal errors when plugins call wp_admin_css() on a non-existent (probably removed) stylesheet. props SergeyBiryukov, fixes #19913.

Note: See TracTickets for help on using tickets.