mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Don't call the size function count() as part of a test condition in loops. Compute the size beforehand, and not on each iteration.
Scrutinizer added a Performance label: these are the only violations. See #30799. git-svn-id: https://develop.svn.wordpress.org/trunk@31554 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -371,9 +371,11 @@ class WP_Filesystem_Base {
|
||||
$legal = array('', 'w', 'r', 'x', '-');
|
||||
$attarray = preg_split('//', $mode);
|
||||
|
||||
for ($i=0; $i < count($attarray); $i++)
|
||||
if ($key = array_search($attarray[$i], $legal))
|
||||
for ( $i = 0, $c = count( $attarray ); $i < $c; $i++ ) {
|
||||
if ($key = array_search($attarray[$i], $legal)) {
|
||||
$realmode .= $legal[$key];
|
||||
}
|
||||
}
|
||||
|
||||
$mode = str_pad($realmode, 10, '-', STR_PAD_LEFT);
|
||||
$trans = array('-'=>'0', 'r'=>'4', 'w'=>'2', 'x'=>'1');
|
||||
|
||||
Reference in New Issue
Block a user