Making WordPress.org

Ticket #1792: 1792.diff

File 1792.diff, 1.2 KB (added by joelcj91, 6 years ago)

Diff file with fix

  • wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-controls.php

    diff --git wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-controls.php wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-controls.php
    index 280b7fb..d83cfe1 100644
    class Controls { 
    145145                // WordPress.org runs trunk, this keeps the highest version selectable as trunk
    146146                $versions[5] = preg_replace( '!-\d{4,}$!', '', $wp_version );
    147147
    148                 $found = false;
    149                 foreach( $versions as $version ) {
    150                         if ( isset( $all_versions[ $version ] ) && in_array( $tested_up_to, $all_versions[ $version ] ) ) {
    151                                 $tested_up_to = $version;
    152                                 $found = true;
    153                                 break;
    154                         }
    155                 }
    156148                // If the version specified isn't going to display, insert it into the list.
    157                 if ( ! $found ) {
    158                         $versions[4] = $tested_up_to;
    159                         ksort( $versions );
    160                 }
     149        if (!in_array($tested_up_to, $versions)) {
     150            $versions[4] = $tested_up_to;
     151            ksort($versions);
     152        }
    161153
    162154                return compact( 'versions', 'tested_up_to' );
    163155        }