[wp-trac] [WordPress Trac] #54372: class-wp-automatic-updater.php adds a period to home_url()

WordPress Trac noreply at wordpress.org
Thu Nov 4 05:09:37 UTC 2021


#54372: class-wp-automatic-updater.php adds a period to home_url()
----------------------------+-----------------------------
 Reporter:  chris554        |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Administration  |    Version:  trunk
 Severity:  minor           |   Keywords:  needs-patch
  Focuses:  administration  |
----------------------------+-----------------------------
 The automatic emails that are generated by class-wp-automatic-updater.php
 have an issue where a period character immediately follows a home_url()
 string in the body of the message. When using a third-party mailing and/or
 link-branding service on these emails, those periods are being
 incorporated into the links, rendering them useless.

 Example body of an update email:
 Howdy! Some plugins and themes have automatically updated to their latest
 versions on your site at https://www.example.com. No further action is
 needed on your part.

 When passed through a service that brands the links, such as MailChimp or
 SendGrid, that URL is interpreted as "https://www.example.com.", and not
 as "https://www.example.com"

 The code for this is reused through the file, but an example starts at
 line 1031:
         {{{#!php
 <?php
                 switch ( $type ) {
                                 case 'success':
                                         if ( $successful_plugins &&
 $successful_themes ) {
                                                 /* translators: %s: Site
 title. */
                                                 $subject = __( '[%s] Some
 plugins and themes have automatically updated' );
                                                 $body[]  = sprintf(
                                                         /* translators:
 %s: Home URL. */
                                                         __( 'Howdy! Some
 plugins and themes have automatically updated to their latest versions on
 your site at %s. No further action is needed on your part.' ),
                                                         home_url()
                                                 );
 }}}

 You can see the sprintf() string in the $body[] section has "%s." which
 renders as "home_url().", which renders to https://www.example.com.
 leading to the period being interpreted as part of the link.

 This is present at lines:
 1038
 1046
 1054
 1067
 1075
 1083

 **Suggested fix**: add a space between the %s and the period, or eliminate
 the period from the string entirely. Either would fix the issue with
 minimal changes.

 I would submit a change myself but I'm at the absolute limit of my coding
 abilities here, just finding what sent the email and why the period was
 there took all my effort.

 I realize that this is a minor bug, but it does render the links in the
 update emails un-clickable, a real hassle when I have 20+ sites emailing
 me and I'm trying to quickly click to the one with the issue.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54372>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list