Skip to content

Commit fca35c4

Browse files
authored
Merge pull request #1828 from spenserhale/fix/handling-getpwuid-failure
fix: handling when posix_getpwuid return false
2 parents 40aa500 + f369f73 commit fca35c4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

classes/class-log.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ public function log( $connector, $message, $args, $object_id, $context, $action,
9292
if ( 'wp_cli' === $agent && function_exists( 'posix_getuid' ) ) {
9393
$uid = posix_getuid();
9494
$user_info = posix_getpwuid( $uid );
95+
if( ! is_array( $user_info ) ) {
96+
$user_info = array( 'name' => 'unknown' );
97+
}
9598

9699
$user_meta['system_user_id'] = (int) $uid;
97100
$user_meta['system_user_name'] = (string) $user_info['name'];

0 commit comments

Comments
 (0)