Skip to content

Commit 6244d51

Browse files
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. git-svn-id: https://develop.svn.wordpress.org/trunk@52996 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 3758272 commit 6244d51

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

src/wp-admin/includes/class-ftp.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ function glob($pattern, $handle=NULL) {
792792
return false;
793793
}
794794

795-
function glob_pattern_match($pattern,$string) {
795+
function glob_pattern_match($pattern,$subject) {
796796
$out=null;
797797
$chunks=explode(';',$pattern);
798798
foreach($chunks as $pattern) {
@@ -807,19 +807,20 @@ function glob_pattern_match($pattern,$string) {
807807
str_replace('?','.{1,1}',$pattern))));
808808
$out[]=$pattern;
809809
}
810-
if(count($out)==1) return($this->glob_regexp("^$out[0]$",$string));
810+
if(count($out)==1) return($this->glob_regexp("^$out[0]$",$subject));
811811
else {
812812
foreach($out as $tester)
813-
if($this->my_regexp("^$tester$",$string)) return true;
813+
// TODO: This should probably be glob_regexp(), but needs tests.
814+
if($this->my_regexp("^$tester$",$subject)) return true;
814815
}
815816
return false;
816817
}
817818

818-
function glob_regexp($pattern,$probe) {
819+
function glob_regexp($pattern,$subject) {
819820
$sensitive=(PHP_OS!='WIN32');
820821
return ($sensitive?
821-
preg_match( '/' . preg_quote( $pattern, '/' ) . '/', $probe ) :
822-
preg_match( '/' . preg_quote( $pattern, '/' ) . '/i', $probe )
822+
preg_match( '/' . preg_quote( $pattern, '/' ) . '/', $subject ) :
823+
preg_match( '/' . preg_quote( $pattern, '/' ) . '/i', $subject )
823824
);
824825
}
825826

0 commit comments

Comments
 (0)