[wp-trac] [WordPress Trac] #30831: paginate_links() now needs add_args=false

WordPress Trac noreply at wordpress.org
Wed Feb 11 16:14:37 UTC 2015


#30831: paginate_links() now needs add_args=false
------------------------------------------+-----------------------
 Reporter:  bobbingwide                   |       Owner:
     Type:  defect (bug)                  |      Status:  new
 Priority:  normal                        |   Milestone:  4.1.1
Component:  Themes                        |     Version:  4.1
 Severity:  normal                        |  Resolution:
 Keywords:  has-patch fixed-major commit  |     Focuses:  template
------------------------------------------+-----------------------

Comment (by boonebgorges):

 Replying to [comment:18 dd32]:
 > [31203] has some compatibility issues, particularly around the solution
 to this bug.
 >
 > Previously, you could pass `false` to `add_args` in `paginate_links()`,
 and it'd simply get handled appropriately, however now we treat the field
 as an array, resulting in:  `Warning: array_merge(): Argument #1 is not an
 array in wp-includes/general-template.php on line 2633`.
 >
 > Unfortunately due to this bug, we can't really expect that others
 haven't simply added {{{'add_args' => false}}} to their paginate links
 function, so now we've probably got to add something such as
 [attachment:30831.3.diff 30831.3.diff]

 Yes, good catch. [attachment:30831.4.diff] adds a unit test demonstrating
 the error. I've modified your patch slightly so that the `$add_args`
 variable is still set to `false` if `$args['add_args']` is empty. Letting
 it pass through as an empty array will pass the `if ( $add_args )` tests
 further down in the function; an empty array will be passed to
 `add_query_arg()`, which will have no effect on the function output, but
 is a waste of cycles.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30831#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list