Changeset 64337 for trunk/src/wp-includes/load.php
- Timestamp:
- 10/13/2026 07:54:18 PM (7 hours ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/load.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/load.php
r64305 r64337 826 826 827 827 /** 828 * Loads the secrets.php drop-in, if one exists, and records whether it left the 829 * Secrets API's provider, store, and keyring overrides in a usable state. 830 * 831 * Runs once, before must-use plugins load, so that every interface a drop-in's 832 * classes implement already exists and every plugin sees the drop-in's provider. 833 * 834 * Sets `$GLOBALS['wp_secrets_dropin_loaded']` as soon as the file is found, whether 835 * or not it then loads cleanly: wp_using_secrets_dropin() reports presence, not 836 * health. 837 * 838 * Sets `$GLOBALS['wp_secrets_dropin_broken']` when the require throws, or when any of 839 * `$GLOBALS['wp_secrets_provider']`, `$GLOBALS['wp_secrets_store']`, or 840 * `$GLOBALS['wp_secrets_keyring']` is set to something that does not implement its 841 * interface. A global left unset is fine: a drop-in that overrides only the keyring 842 * leaves the other two alone. Once the flag is set, every Secrets API operation 843 * returns WP_Error for the rest of the request rather than falling back to the 844 * default provider, so a broken drop-in reads as unreachable, never as absent. 845 * 846 * PHP treats a class that implements an interface but omits a required method as an 847 * uncatchable fatal error, even inside the try/catch around the require. That case 848 * cannot be intercepted from PHP code. 849 * 850 * @since 7.2.0 851 * @access private 852 */ 853 function wp_load_secrets_dropin(): void { 854 static $loaded = false; 855 856 if ( $loaded ) { 857 return; 858 } 859 860 $loaded = true; 861 862 $dropin_path = WP_CONTENT_DIR . '/secrets.php'; 863 864 if ( ! file_exists( $dropin_path ) ) { 865 return; 866 } 867 868 $GLOBALS['wp_secrets_dropin_loaded'] = true; 869 870 try { 871 require $dropin_path; 872 } catch ( Throwable $e ) { 873 $GLOBALS['wp_secrets_dropin_broken'] = true; 874 875 return; 876 } 877 878 if ( isset( $GLOBALS['wp_secrets_store'] ) && ! ( $GLOBALS['wp_secrets_store'] instanceof WP_Secrets_Store ) ) { 879 $GLOBALS['wp_secrets_dropin_broken'] = true; 880 } 881 882 if ( isset( $GLOBALS['wp_secrets_keyring'] ) && ! ( $GLOBALS['wp_secrets_keyring'] instanceof WP_Secrets_Keyring ) ) { 883 $GLOBALS['wp_secrets_dropin_broken'] = true; 884 } 885 886 if ( isset( $GLOBALS['wp_secrets_provider'] ) && ! ( $GLOBALS['wp_secrets_provider'] instanceof WP_Secrets_Provider ) ) { 887 $GLOBALS['wp_secrets_dropin_broken'] = true; 888 } 889 } 890 891 /** 828 892 * Starts the WordPress object cache. 829 893 *
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)