Commit 1b22341547 for wordpress.org
commit 1b2234154775f8a33dbb1476474e80536114695b
Author: SergeyBiryukov <sergeybiryukov@git.wordpress.org>
Date: Mon Nov 16 20:47:55 2026 +0000
Code Modernization: Use the null coalescing assignment operator in `wp-includes/option.php`.
Replaces verbose `! isset()` guard blocks that assign default values with the null coalescing assignment operator (`??=`).
**Scope**
This covers `get_transient()` and `get_site_transient()` completely.
**Why this is safe**
- `??=` requires PHP 7.4, which is already the minimum supported version.
- `??=` and `! isset()` test the same condition, so the default is applied in exactly the same cases.
- Assignment order is preserved.
- No behavior change; this is a purely internal syntax simplification.
Developed in https://github.com/WordPress/wordpress-develop/pull/16005.
Props noruzzaman, masteradhoc.
See #65823.
Built from https://develop.svn.wordpress.org/trunk@65535
git-svn-id: http://core.svn.wordpress.org/trunk@64608 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/option.php b/wp-includes/option.php
index efe5709c63..e53aedeb47 100644
--- a/wp-includes/option.php
+++ b/wp-includes/option.php
@@ -1474,9 +1474,7 @@ function get_transient( $transient ) {
}
}
- if ( ! isset( $value ) ) {
- $value = get_option( $transient_option );
- }
+ $value ??= get_option( $transient_option );
}
/**
@@ -2607,9 +2605,7 @@ function get_site_transient( $transient ) {
}
}
- if ( ! isset( $value ) ) {
- $value = get_site_option( $transient_option );
- }
+ $value ??= get_site_option( $transient_option );
}
/**
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 34dc85317f..28e06f415a 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-beta5-65534';
+$wp_version = '7.2-beta5-65535';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.