diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index 8d41efffdc..fbb9633d2a 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -4923,7 +4923,7 @@ function sanitize_option( $option, $value ) { break; case 'timezone_string': - $allowed_zones = timezone_identifiers_list(); + $allowed_zones = timezone_identifiers_list( DateTimeZone::ALL_WITH_BC ); if ( ! in_array( $value, $allowed_zones, true ) && ! empty( $value ) ) { $error = __( 'The timezone you have entered is not valid. Please select a valid timezone.' ); } diff --git a/tests/phpunit/tests/option/sanitizeOption.php b/tests/phpunit/tests/option/sanitizeOption.php index bc0dd0843b..dec3cf7ced 100644 --- a/tests/phpunit/tests/option/sanitizeOption.php +++ b/tests/phpunit/tests/option/sanitizeOption.php @@ -69,6 +69,12 @@ class Tests_Option_SanitizeOption extends WP_UnitTestCase { array( 'timezone_string', 0, 0 ), array( 'timezone_string', 'Europe/London', 'Europe/London' ), array( 'timezone_string', get_option( 'timezone_string' ), 'invalid' ), + // @ticket 56468 + 'deprecated timezone string is accepted as valid' => array( + 'option_name' => 'timezone_string', + 'sanitized' => 'America/Buenos_Aires', + 'original' => 'America/Buenos_Aires', + ), array( 'permalink_structure', '', '' ), array( 'permalink_structure', '/%year%/%20%postname%', '/%year%/ %postname%' ), array( 'default_role', 'subscriber', 'subscriber' ),