- md5
- 169614ca53d5c22621344ee03e4a5c31
- sha1
- 98e55871433c16662b99aad64c341b565c660707
- sha256
- aa30d1f32167a28b296333eac34dda02262254b46d8f6701e6437e200c2e8fa5
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
<?php
/**
* Secrets API: WP_Secrets_Broken_Keyring class
*
* @package WordPress
* @subpackage Secrets
* @since 7.2.0
*/
/**
* Stands in for the keyring when a drop-in leaves an invalid value behind.
*
* Installed when a secrets.php drop-in exists but $GLOBALS['wp_secrets_keyring'] does
* not hold a WP_Secrets_Keyring.
*
* Same reasoning as WP_Secrets_Broken_Store: the drop-in's presence signals the
* operator wants a keyring other than the default, so silently falling back to
* WP_Secrets_Config_Key_Provider would wrap the root key under a key the operator
* did not choose. Every operation fails closed instead.
*
* @since 7.2.0
*/
final class WP_Secrets_Broken_Keyring implements WP_Secrets_Keyring {
/**
* Always fails closed.
*
* @since 7.2.0
*
* @param string $key_material Ignored.
* @return WP_Error
*/
public function wrap( string $key_material ): WP_Error {
return $this->error();
}
/**
* Always fails closed.
*
* @since 7.2.0
*
* @param string $wrapped Ignored.
* @return WP_Error
*/
public function unwrap( string $wrapped ): WP_Error {
return $this->error();
}
/**
* Describes the broken state, for Site Health.
*
* @since 7.2.0
*
* @return string
*/
public function get_key_source(): string {
return __( 'broken secrets.php drop-in' );
}
/**
* Builds the error every method returns.
*
* @since 7.2.0
*
* @return WP_Error
*/
private function error(): WP_Error {
return new WP_Error(
WP_SECRETS_ERROR_KEY_UNAVAILABLE,
__( 'The secrets.php drop-in did not provide a usable keyring.' )
);
}
}
The same content is in 4 releases, WordPress 7.2-beta1 to 7.2-beta4. See them all, or every version of this file.