From ff131f5e293aa72a50cfd9bc47b389aefa1a12cb Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
Date: Mon, 20 May 2019 14:28:03 +0000
Subject: [PATCH] Upgrade/Install: As a follow-up to [45357], when linking to
Update PHP support page in error messages, check if `wp_get_update_php_url()`
and `wp_get_update_php_annotation()` exist.
`wp-admin/includes/update-core.php` runs in the context of the previous WordPress version. Any calls to newly introduced functions there need to be checked via `function_exists()`.
Reviewed by desrosj, earnjam, SergeyBiryukov.
Props dd32, imath.
Fixes #47323.
git-svn-id: https://develop.svn.wordpress.org/trunk@45365 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/includes/update-core.php | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php
index 02461acf8c..d1282fa6e2 100644
--- a/src/wp-admin/includes/update-core.php
+++ b/src/wp-admin/includes/update-core.php
@@ -946,12 +946,17 @@ function update_core( $from, $to ) {
$wp_filesystem->delete( $from, true );
}
- /* translators: %s: Update PHP page URL */
- $php_update_message = '
' . sprintf( __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) );
+ $php_update_message = '';
+ if ( function_exists( 'wp_get_update_php_url' ) ) {
+ /* translators: %s: Update PHP page URL */
+ $php_update_message = '
' . sprintf( __( '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 ( function_exists( 'wp_get_update_php_annotation' ) ) {
+ $annotation = wp_get_update_php_annotation();
+ if ( $annotation ) {
+ $php_update_message .= '
' . $annotation . '';
+ }
+ }
}
if ( ! $mysql_compat && ! $php_compat ) {