Tons of “Trying to access array offset on value of type bool” warnings
-
Hello,
I upgraded a site from WP 5.9 to WP 6.5, and I’m now facing the following issue (using BackWPUP Version 4.1.3): I receive tons of “Trying to access array offset on value of type bool” warnings during the archive creation.
I’m on a docker setup (using image wordpress:6.5), and WordPress is running as www-data.www-data (uid 33 gid 33). I’ve debugged, and found that in class-create-archive.php, the function posix_getpwuid($uid, $gid) triggers this warning when trying to access the $info array, on both lines 905 and 907:private function posix_getpwuid($uid, $gid)
{
// Set file user/group name if linux.
$owner = esc_html__('Unknown', 'backwpup');
$group = esc_html__('Unknown', 'backwpup');
if (function_exists('posix_getpwuid')) {
$info = posix_getpwuid($uid);
$owner = $info['name']; <-- WARNING HERE
$info = posix_getgrgid($gid);
$group = $info['name']; <-- WARNING HERE
}
return [
$owner,
$group,
];
}The lines that triggers the error is:
$owner = $info['name'];
I’ve made this naive check that removes the warning:
if (is_array($info) && isset($info['name'])) {
$owner = $info['name'];
}(I did the same for the second call that also triggers the warning: $info = posix_getgrgid($gid);)
Now the backup is going smoothly.
Can you please investigate, and maybe add my fix (or something similar) to prevent the warning ?If you want to reproduce the issue, here is how I launch backwpup (I’ve only 1 backup task)
docker run --rm --user 33:33 --volumes-from mysite --env-file config/mysite.env wordpress:cli wp backwpup start 1
config/mysite.env contains the WORDPRESS_DB_… variables.
Thank you very much,
- You must be logged in to reply to this topic.