Make WordPress Core


Ignore:
Timestamp:
11/26/2025 09:50:02 PM (12 months ago)
Author:
SergeyBiryukov
Message:

Filesystem API: Check for the correct result in some WP_Filesystem_FTPext methods.

This avoids a PHP warning when ::dirlist() returns false under certain conditions:

Warning: Trying to access array offset on value of type bool in wp-admin/includes/class-wp-filesystem-ftpsockets.php on line 326

Follow-up to [6779], [30678], [45226].

Props apermo, malt3, SergeyBiryukov.
Fixes #63474.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-filesystem-ftpext.php

    r61116 r61311  
    300300                $dir = $this->dirlist( $file );
    301301
    302                 return $dir[ $file ]['owner'];
     302                return $dir[ $file ]['owner'] ?? '';
    303303        }
    304304
    … …  
    314314                $dir = $this->dirlist( $file );
    315315
    316                 return $dir[ $file ]['permsn'];
     316                return $dir[ $file ]['permsn'] ?? '';
    317317        }
    318318
    … …  
    328328                $dir = $this->dirlist( $file );
    329329
    330                 return $dir[ $file ]['group'];
     330                return $dir[ $file ]['group'] ?? '';
    331331        }
    332332
Note: See TracChangeset for help on using the changeset viewer.