diff --git a/wp-includes/version.php b/wp-includes/version.php index 1e2d284696..133601e3e3 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.5-alpha-57621'; +$wp_version = '6.5-alpha-57622'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-settings.php b/wp-settings.php index 217d97c94d..2772568dee 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -503,68 +503,79 @@ $all_plugin_data = get_option( 'plugin_data', array() ); $failed_plugins = array(); $plugins_dir_strlen = strlen( trailingslashit( WP_PLUGIN_DIR ) ); foreach ( wp_get_active_and_valid_plugins() as $plugin ) { - $plugin_file = substr( $plugin, $plugins_dir_strlen ); - $plugin_headers = $all_plugin_data[ $plugin_file ]; - $errors = array(); - $requirements = array( - 'requires' => ! empty( $plugin_headers['RequiresWP'] ) ? $plugin_headers['RequiresWP'] : '', - 'requires_php' => ! empty( $plugin_headers['RequiresPHP'] ) ? $plugin_headers['RequiresPHP'] : '', - ); - $compatible_wp = is_wp_version_compatible( $requirements['requires'] ); - $compatible_php = is_php_version_compatible( $requirements['requires_php'] ); + $plugin_file = substr( $plugin, $plugins_dir_strlen ); - $php_update_message = '

' . sprintf( - /* translators: %s: URL to Update PHP page. */ - __( 'Learn more about updating PHP.' ), - esc_url( wp_get_update_php_url() ) - ); - - $annotation = wp_get_update_php_annotation(); - - if ( $annotation ) { - $php_update_message .= '

' . $annotation . ''; - } - - if ( ! $compatible_wp && ! $compatible_php ) { - $errors[] = sprintf( - /* translators: 1: Current WordPress version, 2: Current PHP version, 3: Plugin name, 4: Required WordPress version, 5: Required PHP version. */ - _x( 'Error: Current versions of WordPress (%1$s) and PHP (%2$s) do not meet minimum requirements for %3$s. The plugin requires WordPress %4$s and PHP %5$s.', 'plugin' ), - get_bloginfo( 'version' ), - PHP_VERSION, - $plugin_headers['Name'], - $requirements['requires'], - $requirements['requires_php'] - ) . $php_update_message; - } elseif ( ! $compatible_php ) { - $errors[] = sprintf( - /* translators: 1: Current PHP version, 2: Plugin name, 3: Required PHP version. */ - _x( 'Error: Current PHP version (%1$s) does not meet minimum requirements for %2$s. The plugin requires PHP %3$s.', 'plugin' ), - PHP_VERSION, - $plugin_headers['Name'], - $requirements['requires_php'] - ) . $php_update_message; - } elseif ( ! $compatible_wp ) { - $errors[] = sprintf( - /* translators: 1: Current WordPress version, 2: Plugin name, 3: Required WordPress version. */ - _x( 'Error: Current WordPress version (%1$s) does not meet minimum requirements for %2$s. The plugin requires WordPress %3$s.', 'plugin' ), - get_bloginfo( 'version' ), - $plugin_headers['Name'], - $requirements['requires'] + /* + * Skip any plugins that have not been added to the 'plugin_data' option yet. + * + * Some plugin files may be added locally and activated, but will not yet be + * added to the 'plugin_data' option. This causes the 'active_plugins' option + * and the 'plugin_data' option to be temporarily out of sync until the next + * call to `get_plugins()`. + */ + if ( isset( $all_plugin_data[ $plugin_file ] ) ) { + $plugin_headers = $all_plugin_data[ $plugin_file ]; + $errors = array(); + $requirements = array( + 'requires' => ! empty( $plugin_headers['RequiresWP'] ) ? $plugin_headers['RequiresWP'] : '', + 'requires_php' => ! empty( $plugin_headers['RequiresPHP'] ) ? $plugin_headers['RequiresPHP'] : '', ); - } + $compatible_wp = is_wp_version_compatible( $requirements['requires'] ); + $compatible_php = is_php_version_compatible( $requirements['requires_php'] ); - if ( ! empty( $errors ) ) { - $failed_plugins[ $plugin_file ] = ''; - foreach ( $errors as $error ) { - $failed_plugins[ $plugin_file ] .= wp_get_admin_notice( - $error, - array( - 'type' => 'error', - 'dismissible' => true, - ) + $php_update_message = '

' . sprintf( + /* translators: %s: URL to Update PHP page. */ + __( 'Learn more about updating PHP.' ), + esc_url( wp_get_update_php_url() ) + ); + + $annotation = wp_get_update_php_annotation(); + + if ( $annotation ) { + $php_update_message .= '

' . $annotation . ''; + } + + if ( ! $compatible_wp && ! $compatible_php ) { + $errors[] = sprintf( + /* translators: 1: Current WordPress version, 2: Current PHP version, 3: Plugin name, 4: Required WordPress version, 5: Required PHP version. */ + _x( 'Error: Current versions of WordPress (%1$s) and PHP (%2$s) do not meet minimum requirements for %3$s. The plugin requires WordPress %4$s and PHP %5$s.', 'plugin' ), + get_bloginfo( 'version' ), + PHP_VERSION, + $plugin_headers['Name'], + $requirements['requires'], + $requirements['requires_php'] + ) . $php_update_message; + } elseif ( ! $compatible_php ) { + $errors[] = sprintf( + /* translators: 1: Current PHP version, 2: Plugin name, 3: Required PHP version. */ + _x( 'Error: Current PHP version (%1$s) does not meet minimum requirements for %2$s. The plugin requires PHP %3$s.', 'plugin' ), + PHP_VERSION, + $plugin_headers['Name'], + $requirements['requires_php'] + ) . $php_update_message; + } elseif ( ! $compatible_wp ) { + $errors[] = sprintf( + /* translators: 1: Current WordPress version, 2: Plugin name, 3: Required WordPress version. */ + _x( 'Error: Current WordPress version (%1$s) does not meet minimum requirements for %2$s. The plugin requires WordPress %3$s.', 'plugin' ), + get_bloginfo( 'version' ), + $plugin_headers['Name'], + $requirements['requires'] ); } - continue; + + if ( ! empty( $errors ) ) { + $failed_plugins[ $plugin_file ] = ''; + foreach ( $errors as $error ) { + $failed_plugins[ $plugin_file ] .= wp_get_admin_notice( + $error, + array( + 'type' => 'error', + 'dismissible' => true, + ) + ); + } + continue; + } } wp_register_plugin_realpath( $plugin );