[wp-trac] [WordPress Trac] #50373: Notice: Trying to access array offset on value of type bool in /wp-admin/includes/class-wp-filesystem-direct.php on line 260

WordPress Trac noreply at wordpress.org
Fri Jun 12 12:32:08 UTC 2020


#50373: Notice: Trying to access array offset on value of type bool in /wp-
admin/includes/class-wp-filesystem-direct.php on line 260
----------------------------+---------------------
 Reporter:  logig           |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  5.5
Component:  Filesystem API  |     Version:  5.4.2
 Severity:  normal          |  Resolution:
 Keywords:  needs-patch     |     Focuses:
----------------------------+---------------------

Comment (by SergeyBiryukov):

 Hi there, welcome to WordPress Trac! Thanks for the report.

 The PHP manual mentions that
 [https://www.php.net/manual/en/function.fileowner.php fileowner()] and
 [https://www.php.net/manual/en/function.filegroup.php filegroup()] return
 false on failure, but doesn't mention the same for
 [https://www.php.net/manual/en/function.posix-getpwuid.php
 posix_getpwuid()] or [https://www.php.net/manual/en/function.posix-
 getgrgid.php posix_getgrgid()] used in the `WP_Filesystem_Direct` and
 `WP_Filesystem_SSH2` classes.

 Apparently they can still return false in some circumstances, per these
 comments:
 https://www.php.net/manual/en/function.posix-getpwuid.php#45994
 https://www.php.net/manual/en/function.posix-getgrgid.php#90794

 So checking the result seems like a good idea.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50373#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list