Make WordPress Core


Ignore:
Timestamp:
02/26/2015 05:47:53 AM (9 years ago)
Author:
wonderboymusic
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r31451 r31554  
    15171517        if ( $dir_perms != ( $dir_perms & ~umask() ) ) {
    15181518            $folder_parts = explode( '/', substr( $target, strlen( $target_parent ) + 1 ) );
    1519             for ( $i = 1; $i <= count( $folder_parts ); $i++ ) {
     1519            for ( $i = 1, $c = count( $folder_parts ); $i <= $c; $i++ ) {
    15201520                @chmod( $target_parent . '/' . implode( '/', array_slice( $folder_parts, 0, $i ) ), $dir_perms );
    15211521            }
Note: See TracChangeset for help on using the changeset viewer.