Make WordPress Core

Opened 13 years ago

Closed 12 years ago

#20062 closed defect (bug) (fixed)

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

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

Description

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 13 years ago.

Download all attachments as: .zip

Change History (5)

@ocean90
13 years ago

#1 @koopersmith
13 years ago

In [19941]:

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

#2 @nacin
13 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).

#3 @koopersmith
13 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.

#4 @nacin
12 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.