Skip to:
Content

BuddyPress.org

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#5847 closed enhancement (fixed)

ABSPATH checks could be simpler

Reported by: johnjamesjacoby Owned by: johnjamesjacoby
Milestone: 2.2 Priority: normal
Severity: normal Version:
Component: Core Keywords:
Cc:

Description

We currently do:

if ( !defined( 'ABSPATH' ) ) exit;

But could get away with:

defined( 'ABSPATH' ) || exit;

Two wins here:

  • Simpler code and a bit easier on the eyes
  • Passes code styling linters looking for brackets on comparisons

129 instances would need changing. The task is trivial, but the changes are sprawling. I figure we can do this in 2.2 to avoid changing basically every file in the project while in beta, but if no one is vehemently opposed, we can do this pretty much anytime.

Change History (8)

#1 @netweb
5 years ago

Related: #5891

#2 @DJPaul
5 years ago

  • Milestone changed from 2.2 to Future Release

#3 @johnjamesjacoby
5 years ago

  • Owner set to johnjamesjacoby
  • Resolution set to fixed
  • Status changed from new to closed

In 9351:

SimplifyABSPATH checks across all files for improved Scrutinizer compliance.

See #5891. Fixes #5847.

#4 @johnjamesjacoby
5 years ago

  • Milestone changed from Future Release to 2.2

#5 @johnjamesjacoby
5 years ago

  • Component changed from Component - Any/All to Tools - Code Improvement

#6 @johnjamesjacoby
5 years ago

In 9458:

Simplify more ABSPATH checks. See #5847, #5891, r9351.

#7 @DJPaul
3 years ago

  • Component changed from Tools - Code Improvement to Core

#8 @DJPaul
3 years ago

  • Type changed from task to enhancement
Note: See TracTickets for help on using tickets.