[wp-trac] [WordPress Trac] #64426: WP_Filesystem_Direct::getchmod() does not handle fileperms() errors

WordPress Trac noreply at wordpress.org
Wed Dec 17 14:38:11 UTC 2025


#64426: WP_Filesystem_Direct::getchmod() does not handle fileperms() errors
--------------------------+-----------------------------
 Reporter:  vietcgi       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Description:
   The `getchmod()` method in `WP_Filesystem_Direct` has a documented
 FIXME:

   "FIXME does not handle errors in fileperms()"

   When a file doesn't exist, `fileperms()` returns `false`, which gets
 converted to `'0'` - not a valid permission string.

   This PR fixes it by returning `false` on failure, matching the pattern
 used by `owner()` and `group()` in the same class.

   PR: https://github.com/WordPress/wordpress-develop/pull/10637

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64426>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list