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-ssh2.php

    r47808 r48031  
    403403        }
    404404        $ownerarray = posix_getpwuid( $owneruid );
     405        if ( ! $ownerarray ) {
     406            return false;
     407        }
    405408        return $ownerarray['name'];
    406409    }
     
    435438        }
    436439        $grouparray = posix_getgrgid( $gid );
     440        if ( ! $grouparray ) {
     441            return false;
     442        }
    437443        return $grouparray['name'];
    438444    }
Note: See TracChangeset for help on using the changeset viewer.