Make WordPress Core

Opened 4 months ago

Last modified 4 months ago

#58484 new defect (bug)

Always use wp_get_environment_type in all sources

Reported by: ramon-fincken's profile ramon fincken Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.3
Component: Bootstrap/Load Keywords: has-patch
Focuses: Cc:


This is a follow up on

where we need to have just a single function to be called which determines the environment type.

As wp-admin/includes/class-wp-debug-data.php is already using:

$environment_type       = wp_get_environment_type();

and later on:
this happens

			$wp_environment_type = WP_ENVIRONMENT_TYPE;
		} else {
			$wp_environment_type = __( 'Undefined' );

so this is not the same as what happens at wp_get_environment_type();

So this ticket is where we remove that lines of code.

Attachments (3)

patch.58484.20230608.1.diff (702 bytes) - added by ramon fincken 4 months ago.
patch.58484.20230608.2.diff (680 bytes) - added by ramon fincken 4 months ago.
patch.58484.20230608.3.diff (3.0 KB) - added by ramon fincken 4 months ago.

Download all attachments as: .zip

Change History (7)

@ramon fincken
4 months ago


This ticket was mentioned in Slack in #core by ramonfincken. View the logs.

4 months ago

#2 @ramon fincken
4 months ago

a small update on this, checked with @SergeyBiryukov

this code is accurate meaning it is shown in the tools -> constants.

I will just show the PHP constant which does not have a need to call wp_get_environment_type()

However ... if you have defined WP_ENVIRONMENT_TYPE and it is empty this code will show "Undefined" while it is actually defined indeed.

#3 @ramon fincken
4 months ago

creating a new patch for this

@ramon fincken
4 months ago


@ramon fincken
4 months ago


#4 @ramon fincken
4 months ago

Added function

private static function get_define_info( $constant_name ) {
Note: See TracTickets for help on using tickets.