Make WordPress Core

Opened 13 years ago

Closed 12 years ago

#1902 closed defect (bug) (fixed)

/wp-admin/templates.php asks for file description of "" and file_exists returns True

Reported by: wmswms Owned by:
Milestone: 2.1 Priority: normal
Severity: normal Version: 1.5.2
Component: Administration Keywords: get_file_description PHP5 templates recently edited wp-admin has-patch
Focuses: Cc:


This problem has been reported in the support area of the main site but I couldnt find anything about it here. Probably a known PHP5 bug. I provide a suggested fix.

Server: Windows 2003 PHP 5.0.4 MySQL 4.1 WordPress 1.5.2

In the recently edited list for /wp-admin/templates.php, the get_option() call to get the recently edited files from the DB seems to also grab a "" entry. When get_file_description("") is called, it calls file_exists(ABSPATH.""), which is true, since its a directory. This causes an error from file() and implode() around line 938 of /wp-admin/admin-functions.php. Checking is_file() ensures that you arent trying to find a directory.

I fixed it by changing admin-functions.php:937


} elseif ( file_exists( ABSPATH . $file ) ) {


} elseif ( file_exists( ABSPATH . $file ) and is_file(ABSPATH . $file) )

Change History (2)

#1 @davidhouse
12 years ago

  • Keywords bg|has-patch added

#2 @Nazgul
12 years ago

  • Keywords has-patch added; bg|has-patch removed
  • Milestone set to 2.1
  • Resolution set to fixed
  • Status changed from new to closed

Fixed in changeset 3770.

Note: See TracTickets for help on using tickets.