Make WordPress Core

Opened 12 months ago

Last modified 12 months ago

#58987 new enhancement

Unify usage of die(), die( '-1' ), exit();

Reported by: presskopp's profile Presskopp Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version:
Component: General Keywords: needs-dev-note
Focuses: coding-standards Cc:

Description

like mentioned here I'd like to know if we want to unify the different die() calls we use:

// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
        die( '-1' );
}

(mostly used, having a comment)

if ( ! defined( 'ABSPATH' ) ) {
        die();
}

(not having a comment), like seen in \wp-admin\link-parse-opml.php, \wp-admin\site-health-info.php

or even

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

like seen in \wp-includes\rss-functions.php

Change History (1)

#1 @rajinsharwar
12 months ago

  • Focuses coding-standards added
  • Keywords needs-dev-note added
  • Severity changed from normal to minor
  • Type changed from defect (bug) to enhancement

Based on this theory, I guess we should consider using die() everywhere instead of exit of die(-1).

https://img001.prntscr.com/file/img001/bvohLKHlQJ2PhOwMlQDaeA.png

Also, I don't think it's a bug, could go as a code enhancement.

Note: See TracTickets for help on using tickets.