Code Modernization: Rename parameters that use reserved keywords in `wp-admin/includes/class-ftp.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names. This commit renames the `$string` parameter of `ftp_base::glob_pattern_match()` to `$subject`. Follow-up to [52946]. Props jrf, aristath, poena, justinahinon, SergeyBiryukov. See #55327. Built from https://develop.svn.wordpress.org/trunk@52996 git-svn-id: http://core.svn.wordpress.org/trunk@52585 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f0d2ba5be0
commit
6ada28a47b
|
@ -792,7 +792,7 @@ class ftp_base {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function glob_pattern_match($pattern,$string) {
|
function glob_pattern_match($pattern,$subject) {
|
||||||
$out=null;
|
$out=null;
|
||||||
$chunks=explode(';',$pattern);
|
$chunks=explode(';',$pattern);
|
||||||
foreach($chunks as $pattern) {
|
foreach($chunks as $pattern) {
|
||||||
|
@ -807,19 +807,20 @@ class ftp_base {
|
||||||
str_replace('?','.{1,1}',$pattern))));
|
str_replace('?','.{1,1}',$pattern))));
|
||||||
$out[]=$pattern;
|
$out[]=$pattern;
|
||||||
}
|
}
|
||||||
if(count($out)==1) return($this->glob_regexp("^$out[0]$",$string));
|
if(count($out)==1) return($this->glob_regexp("^$out[0]$",$subject));
|
||||||
else {
|
else {
|
||||||
foreach($out as $tester)
|
foreach($out as $tester)
|
||||||
if($this->my_regexp("^$tester$",$string)) return true;
|
// TODO: This should probably be glob_regexp(), but needs tests.
|
||||||
|
if($this->my_regexp("^$tester$",$subject)) return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function glob_regexp($pattern,$probe) {
|
function glob_regexp($pattern,$subject) {
|
||||||
$sensitive=(PHP_OS!='WIN32');
|
$sensitive=(PHP_OS!='WIN32');
|
||||||
return ($sensitive?
|
return ($sensitive?
|
||||||
preg_match( '/' . preg_quote( $pattern, '/' ) . '/', $probe ) :
|
preg_match( '/' . preg_quote( $pattern, '/' ) . '/', $subject ) :
|
||||||
preg_match( '/' . preg_quote( $pattern, '/' ) . '/i', $probe )
|
preg_match( '/' . preg_quote( $pattern, '/' ) . '/i', $subject )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.0-alpha-52995';
|
$wp_version = '6.0-alpha-52996';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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