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. Built from https://develop.svn.wordpress.org/trunk@48031 git-svn-id: http://core.svn.wordpress.org/trunk@47798 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
99c6adfeaa
commit
4cc11cdbdd
|
@ -223,6 +223,9 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
return $owneruid;
|
return $owneruid;
|
||||||
}
|
}
|
||||||
$ownerarray = posix_getpwuid( $owneruid );
|
$ownerarray = posix_getpwuid( $owneruid );
|
||||||
|
if ( ! $ownerarray ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return $ownerarray['name'];
|
return $ownerarray['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,6 +260,9 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
return $gid;
|
return $gid;
|
||||||
}
|
}
|
||||||
$grouparray = posix_getgrgid( $gid );
|
$grouparray = posix_getgrgid( $gid );
|
||||||
|
if ( ! $grouparray ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return $grouparray['name'];
|
return $grouparray['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -402,6 +402,9 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
|
||||||
return $owneruid;
|
return $owneruid;
|
||||||
}
|
}
|
||||||
$ownerarray = posix_getpwuid( $owneruid );
|
$ownerarray = posix_getpwuid( $owneruid );
|
||||||
|
if ( ! $ownerarray ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return $ownerarray['name'];
|
return $ownerarray['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,6 +437,9 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
|
||||||
return $gid;
|
return $gid;
|
||||||
}
|
}
|
||||||
$grouparray = posix_getgrgid( $gid );
|
$grouparray = posix_getgrgid( $gid );
|
||||||
|
if ( ! $grouparray ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return $grouparray['name'];
|
return $grouparray['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.5-alpha-48028';
|
$wp_version = '5.5-alpha-48031';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue