WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#44249 closed defect (bug) (fixed)

Assignments must be the first block of code on a line

Reported by: subrataemfluence Owned by: pento
Milestone: 5.1 Priority: normal
Severity: normal Version:
Component: Plugins Keywords: has-patch dev-feedback
Focuses: coding-standards Cc:

Description

File: wp-admin/includes/plugin.php
Function: get_plugins
Line number: 247

Original function body:

<?php
function get_plugins( $plugin_folder = '' ) {

   if ( ! $cache_plugins = wp_cache_get( 'plugins', 'plugins' ) ) {
        $cache_plugins = array();
   }
}

Revised function body:

<?php
function get_plugins( $plugin_folder = '' ) {
        
   $cache_plugins = wp_cache_get( 'plugins', 'plugins' );
                
   if ( ! $cache_plugins ) {
      $cache_plugins = array();
   }
}

I have uploaded a proposed patch.

Attachments (1)

44249.diff (443 bytes) - added by subrataemfluence 3 years ago.

Download all attachments as: .zip

Change History (4)

#1 @subrataemfluence
3 years ago

  • Component changed from General to Plugins
  • Focuses coding-standards added
  • Keywords has-patch dev-feedback added
  • Version set to trunk

#2 @pento
3 years ago

  • Milestone changed from Awaiting Review to 5.1
  • Owner set to pento
  • Status changed from new to assigned
  • Version trunk deleted

#3 @pento
3 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 44630:

Coding Standards: Remove an assignment in a conditional from get_plugins().

Props subrataemfluence.
Fixes #44249.

Note: See TracTickets for help on using tickets.