WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#19913 closed defect (bug) (fixed)

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

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

Description

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.

http://wordpress.org/support/topic/33-fatal-error-with-login-lock?replies=4

http://www.google.com/search?q=wordpress+3.3+plugin+is_rtl&gbv=1

Attachments (1)

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

Download all attachments as: .zip

Change History (7)

comment:1 follow-up: duck_2 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.

comment:2 SergeyBiryukov2 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 2 years ago by SergeyBiryukov (previous) (diff)

comment:3 in reply to: ↑ 1 convissor2 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?

comment:4 nacin2 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.

SergeyBiryukov2 years ago

comment:5 SergeyBiryukov2 years ago

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

comment:6 nacin2 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.