[buddypress-trac] [BuddyPress Trac] #5796: Invalid or empty page_arg results in no-limit queries

buddypress-trac noreply at wordpress.org
Tue Aug 5 11:59:05 UTC 2014


#5796: Invalid or empty page_arg results in no-limit queries
-------------------------------------+------------------
 Reporter:  johnjamesjacoby          |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  high                     |   Milestone:  2.1
Component:  All Components           |     Version:
 Severity:  major                    |  Resolution:
 Keywords:  needs-patch 2nd-opinion  |
-------------------------------------+------------------

Comment (by boonebgorges):

 Yes, I think your technique here is good. I want to be very careful not to
 break any implementations that are intentionally pulling up unpaginated
 results by passing 0 to the function, but like you, I don't see any valid
 reason to allow this to be set via the URL string.

 On a somewhat related note, the whole logic for grabbing these params out
 of the URL seems messed up to me. Values passed to the function should
 always take precedence. See #5796 for a similar point with respect to
 `bp_has_groups()`. In that case, we moved the `$_REQUEST` logic *above*
 the definition of the function defaults. In this case, that's not possible
 because of the variable `pag_arg`; but it does seem to me that the logic
 should be opposite of what it currently is:

 {{{
 // Check the passed arguments directly
 if ( ! isset( $args['num'] ) && ! empty( $_REQUEST['num'] ) ) {
     $this->pag_num = intval( $_REQUEST['num'] );
 } else {
     $this->pag_num = intval( $r['page'] );
 }}}

 and likewise for pag_page. (I don't think that this latter bit needs to be
 fixed for BP 2.1.)

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5796#comment:4>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list