Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#20062 closed defect (bug) (fixed)

Don't use $title as var name if it's in global context

Reported by: ocean90 Owned by:
Milestone: 3.4 Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch
Focuses: Cc:


In admin-header.php we declare $title as a global variable. $title should be used for setting up the title of the page.

In wp-admin/themes.php line 240 we are using $title as a variable name, but not for setting up the title.

A result of this is, that get_admin_page_title() can return a wrong title. (In this case a broken theme name.)

Attachments (1)

20062.patch (613 bytes) - added by ocean90 2 years ago.

Download all attachments as: .zip

Change History (5)

ocean902 years ago

comment:1 koopersmith2 years ago

In [19941]:

Don't unintentionally override the global variable. props ocean90, see #20062.

comment:2 nacin2 years ago

Let's consider reducing our reliance on $title. Perhaps introduce set_admin_page_title( $title = null ), where if null it returns the set value. Then we take a $title and set it in admin-header, and use it inside get_admin_page_title(). Kills reliance on the global (while we could still set it up, if we wanted).

comment:3 koopersmith2 years ago

I left the ticket open because this is a more general issue — $title is an especially ambiguous name to give a global variable. Nacin, you just beat me to the rest of my comment.

If we decide to fix these instances as they pop up, feel free to close the ticket as fixed.

comment:4 nacin2 years ago

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

Our dependence on $title will have to wait.

Note: See TracTickets for help on using tickets.