Ticket #7875: 7875.8.diff

File 7875.8.diff, 1.2 KB (added by DD32, 4 years ago)
Line 
1Index: wp-admin/includes/class-wp-upgrader.php
2===================================================================
3--- wp-admin/includes/class-wp-upgrader.php     (revision 11076)
4+++ wp-admin/includes/class-wp-upgrader.php     (working copy)
5@@ -722,8 +722,12 @@
6                if ( is_string($errors) ) {
7                        $this->feedback($errors);
8                } elseif ( is_wp_error($errors) && $errors->get_error_code() ) {
9-                       foreach ( $errors->get_error_messages() as $message )
10-                               $this->feedback($message);
11+                       foreach ( $errors->get_error_messages() as $message ) {
12+                               if ( $errors->get_error_data() )
13+                                       $this->feedback($message . ' ' . $errors->get_error_data() );
14+                               else
15+                                       $this->feedback($message);
16+                       }
17                }
18        }
19 
20@@ -731,10 +735,12 @@
21                if ( isset( $this->upgrader->strings[$string]) )
22                        $string = $this->upgrader->strings[$string];
23 
24-               $args = func_get_args();
25-               $args = array_splice($args, 1);
26-               if ( !empty($args) )
27-                       $string = vsprintf($string, $args);
28+               if ( strpos($string, '%') !== false ) {
29+                       $args = func_get_args();
30+                       $args = array_splice($args, 1);
31+                       if ( !empty($args) )
32+                               $string = vsprintf($string, $args);
33+               }
34                if ( empty($string) )
35                        return;
36                show_message($string);