From f369f73a3cf3e63f6235a3100d7052c69dce798a Mon Sep 17 00:00:00 2001 From: Spenser Hale Date: Mon, 22 Dec 2025 09:17:42 -0800 Subject: [PATCH] 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' --- classes/class-log.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/classes/class-log.php b/classes/class-log.php index b119affe6..2db16dde1 100644 --- a/classes/class-log.php +++ b/classes/class-log.php @@ -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'];