Upgrade/Install: Make `WP_Filesystem_FTPext::size()` return `false` on failure.
While `WP_Filesystem_Base::size()` is documented to return `false` on failure, `ftp_size()` returns -1, and the method documentation was recently updated to reflect that. This commit restores the previous `@return` tag and corrects the actual return value instead, to bring consistency with all the other `WP_Filesystem_*::size()` methods: * `WP_Filesystem_Base::size()` * `WP_Filesystem_Direct::size()` * `WP_Filesystem_ftpsockets::size()` * `WP_Filesystem_SSH2::size()` {{{ @return int|false Size of the file in bytes on success, false on failure. }}} This better matches the purpose of the API to provide a consistent interface for various filesystem implementations. Follow-up to [6779], [30678], [45226], [53860], [53862]. Fixes #51170. Built from https://develop.svn.wordpress.org/trunk@53898 git-svn-id: http://core.svn.wordpress.org/trunk@53457 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b90c2adb7f
commit
f8c9068b79
|
@ -510,14 +510,14 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
||||||
* Gets the file size (in bytes).
|
* Gets the file size (in bytes).
|
||||||
*
|
*
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
* @since 6.1.0 Corrected the return value: while WP_Filesystem_Base::size()
|
|
||||||
* is documented to return false on failure, ftp_size() returns -1.
|
|
||||||
*
|
*
|
||||||
* @param string $file Path to file.
|
* @param string $file Path to file.
|
||||||
* @return int Size of the file in bytes on success, -1 on failure.
|
* @return int|false Size of the file in bytes on success, false on failure.
|
||||||
*/
|
*/
|
||||||
public function size( $file ) {
|
public function size( $file ) {
|
||||||
return ftp_size( $this->link, $file );
|
$size = ftp_size( $this->link, $file );
|
||||||
|
|
||||||
|
return ( $size > -1 ) ? $size : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.1-alpha-53897';
|
$wp_version = '6.1-alpha-53898';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue