Make WordPress Core


Ignore:
Timestamp:
06/12/2020 12:33:12 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Filesystem API: Avoid a PHP notice in WP_Filesystem_Direct::owner() and ::group() methods and their WP_Filesystem_SSH2 counterparts.

Although not officially documented in the PHP manual, posix_getpwuid() and posix_getgrgid() can return false in some circumstances.

Props logig.
Fixes #50373.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-filesystem-direct.php

    r47808 r48031  
    224224        }
    225225        $ownerarray = posix_getpwuid( $owneruid );
     226        if ( ! $ownerarray ) {
     227            return false;
     228        }
    226229        return $ownerarray['name'];
    227230    }
     
    258261        }
    259262        $grouparray = posix_getgrgid( $gid );
     263        if ( ! $grouparray ) {
     264            return false;
     265        }
    260266        return $grouparray['name'];
    261267    }
Note: See TracChangeset for help on using the changeset viewer.