[wp-trac] [WordPress Trac] #29548: WP_Filesystem_Base::getchmod() reporting permissions incorrectly

WordPress Trac noreply at wordpress.org
Fri Sep 5 21:25:26 UTC 2014


#29548: WP_Filesystem_Base::getchmod() reporting permissions incorrectly
--------------------------+-----------------------------
 Reporter:  mnelson4      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 While doing some unit testing of WP_Filesytem_MockFS, I noticed
 WP_Filesystem_Base::gethchmod() is reporting permissions on files
 incorrectly. It uses an undefined method getchmod() to get the file
 permissions. Most of the children implement it (except
 WP_Filesystem_MockFS see #29544), and most return a string that represents
 the octal representation of the file's permissions. However, the results
 of $this->getchmod($file) need to be an octal number in order to do
 bitwise comparison, like WP_FIlesystem_Base::gethchmod() tries to do on
 it.
 For that reason I suggest the following patch: use `invtval(
 $this->getchmod($file), 8 )` to make the results of
 `$this->getchmod($file)` become an octal number, and define
 WP_Filesystem_Base::getchmod($file) to clarify its the expected return
 type.

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


More information about the wp-trac mailing list