Opened 8 years ago
Closed 7 years ago
#1902 closed defect (bug) (fixed)
/wp-admin/templates.php asks for file description of "" and file_exists returns True
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| 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) )

Fixed in changeset 3770.