[buddypress-trac] [BuddyPress Trac] #7645: gravatar parameters esc_url() function breaks the html formatting.

buddypress-trac noreply at wordpress.org
Fri Dec 15 19:13:13 UTC 2017


#7645: gravatar parameters esc_url() function breaks the html formatting.
----------------------------+-----------------------------
 Reporter:  xavierserranoa  |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Core            |    Version:
 Severity:  normal          |   Keywords:
----------------------------+-----------------------------
 when debugging a site that was displaying gravatars wrong I noticed this
 on buddypress/bp-core/bp-core-avatars.php line 660

 {{{#!php
 <?php
 error_log( print_r($url_args,true));
 }}}

 outputs:

 {{{
 [15-Dec-2017 19:02:33 UTC] Array
 (
     [s] => 30
     [r] => g
     [d] => mm
 )
 }}}


 {{{#!php
 <?php
 error_log( print_r(rawurlencode_deep( array_filter($url_args)),true));
 }}}

 output:

 {{{
 [15-Dec-2017 19:02:33 UTC] Array
 (
     [s] => 30
     [r] => g
     [d] => mm
 )
 }}}

 {{{#!php
 <?php
 error_log( print_r(add_query_arg(rawurlencode_deep(
 array_filter($url_args))),true));
 }}}

 output:

 {{{
 [15-Dec-2017 19:02:33 UTC] /groups/historic-structures/admin/manage-
 members/?s=30&r=g&d=mm
 }}}

 {{{#!php
 <?php
 error_log( print_r(esc_url(add_query_arg(rawurlencode_deep(
 array_filter($url_args)))),true));
 }}}

 output:

 {{{
 [15-Dec-2017 19:02:33 UTC] /groups/historic-structures/admin/manage-
 members/?s=30&r=g&d=mm
 }}}


 {{{#!php
 <?php
 error_log( print_r(esc_url_raw(add_query_arg(rawurlencode_deep(
 array_filter($url_args)))),true));
 }}}

 Output:

 {{{
 [15-Dec-2017 19:02:33 UTC] /groups/historic-structures/admin/manage-
 members/?s=30&r=g&d=mm
 }}}


 removing the :
 {{{
 esc_url()
 }}}
 or probably the best fix which is switching it to use :
 {{{
 esc_url_raw()
 }}}

 will fix the problem

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7645>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list