[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/secrets/ -> class-wp-secrets-broken-keyring.php (source)

   1  <?php
   2  /**
   3   * Secrets API: WP_Secrets_Broken_Keyring class
   4   *
   5   * @package WordPress
   6   * @subpackage Secrets
   7   * @since 7.2.0
   8   */
   9  
  10  /**
  11   * Stands in for the keyring when a drop-in leaves an invalid value behind.
  12   *
  13   * Installed when a secrets.php drop-in exists but $GLOBALS['wp_secrets_keyring'] does
  14   * not hold a WP_Secrets_Keyring.
  15   *
  16   * Same reasoning as WP_Secrets_Broken_Store: the drop-in's presence signals the
  17   * operator wants a keyring other than the default, so silently falling back to
  18   * WP_Secrets_Config_Key_Provider would wrap the root key under a key the operator
  19   * did not choose. Every operation fails closed instead.
  20   *
  21   * @since 7.2.0
  22   */
  23  final class WP_Secrets_Broken_Keyring implements WP_Secrets_Keyring {
  24  
  25      /**
  26       * Always fails closed.
  27       *
  28       * @since 7.2.0
  29       *
  30       * @param string $key_material Ignored.
  31       * @return WP_Error
  32       */
  33  	public function wrap( string $key_material ): WP_Error {
  34          return $this->error();
  35      }
  36  
  37      /**
  38       * Always fails closed.
  39       *
  40       * @since 7.2.0
  41       *
  42       * @param string $wrapped Ignored.
  43       * @return WP_Error
  44       */
  45  	public function unwrap( string $wrapped ): WP_Error {
  46          return $this->error();
  47      }
  48  
  49      /**
  50       * Describes the broken state, for Site Health.
  51       *
  52       * @since 7.2.0
  53       *
  54       * @return string
  55       */
  56  	public function get_key_source(): string {
  57          return __( 'broken secrets.php drop-in' );
  58      }
  59  
  60      /**
  61       * Builds the error every method returns.
  62       *
  63       * @since 7.2.0
  64       *
  65       * @return WP_Error
  66       */
  67  	private function error(): WP_Error {
  68          return new WP_Error(
  69              WP_SECRETS_ERROR_KEY_UNAVAILABLE,
  70              __( 'The secrets.php drop-in did not provide a usable keyring.' )
  71          );
  72      }
  73  }


Generated : Wed Oct 14 08:20:33 2026 Cross-referenced by PHPXref