[buddypress-trac] [BuddyPress Trac] #6252: bp_core_referrer() not returning leading slash

buddypress-trac noreply at wordpress.org
Tue Feb 24 14:18:32 UTC 2015


#6252: bp_core_referrer() not returning leading slash
--------------------------+-----------------------------
 Reporter:  mechter       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  API           |    Version:  2.2.1
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 '''Background:'''

 `bp_core_set_uri_globals()` distinguishes between ajax and non-ajax calls
 like so:

 {{{
 if ( defined( 'DOING_AJAX' ) && DOING_AJAX || strpos(
 $_SERVER['REQUEST_URI'], 'wp-load.php' ) )
         $path = bp_core_referrer();
 else
         $path = esc_url( $_SERVER['REQUEST_URI'] );
 }}}

 An ajax call will leave `$path` without leading slash, whereas a non-ajax
 call results in a leading slash.

 It is important that this be streamlined because the `bp_uri` filter is
 applied to path right after the distinction and plugins/themes may assume
 that a path always has a leading slash only to discover that some ajax
 activity is mysteriously broken. (I know because this is what happened to
 me)

 '''Suggestion:'''

 `bp_core_referrer()` should return a leading slash, indicating an absolute
 path.

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


More information about the buddypress-trac mailing list