Ticket #1902 (closed defect (bug): fixed)

Opened 6 years ago

Last modified 5 years ago

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

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

Description

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

from...

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

to...

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

Change History

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

Fixed in changeset 3770.

Note: See TracTickets for help on using tickets.