Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: handling when posix_getpwuid return false
posix_getpwuid() can return false, and code previously would always treat $user_info as array when it was false, causing errors. Now when posix_getpwuid() returns anything other than array we convert $user_info to array with default name 'unknown'
  • Loading branch information
spenserhale committed Dec 22, 2025
commit f369f73a3cf3e63f6235a3100d7052c69dce798a
3 changes: 3 additions & 0 deletions classes/class-log.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ public function log( $connector, $message, $args, $object_id, $context, $action,
if ( 'wp_cli' === $agent && function_exists( 'posix_getuid' ) ) {
$uid = posix_getuid();
$user_info = posix_getpwuid( $uid );
if( ! is_array( $user_info ) ) {
$user_info = array( 'name' => 'unknown' );
}

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