Pagination URL Encoding Bug
-
Hi, love your plugin but there is a bug in the free Version 6.4.7.2 regarding pagination. On line 1128 of
classes/em-object.phpthis line:$page_link_template = em_add_get_params($page_url, $page_args_escaped, false); //don't html encode, so em_paginate does its thing;Is intended to construct the pagination link template to be passed to
em_paginatefunction with the%page%placeholder but this placeholder itself ends up URL encoded making it impossible forem_paginateto do its required page number string replacement.This stems from the incorrect number of arguments in the line mentioned above. Looking at the
em_add_get_paramsfunction definition we can see that the last parameter always defaults to true:function em_add_get_params($url, $params=array(), $html=true, $encode=true){…}This results in the
%page%segment of the$page_link_templatevariable being URL encoded, to%25page%25. This link template string is then passed to theem_paginatefunction here on line 1130:$return = apply_filters('em_object_get_pagination_links', em_paginate( $page_link_template, $count, $limit, $page, $unique_args, !empty($args['ajax']) ), $page_link_template, $count, $limit, $page);The
em_paginatefunction is not expecting this URL encoded segment, and double URL encodes it before attempting the placeholder string find/replacement operation, which results in it not being able to find/replace the placeholder and the pagination link passed to the frontend being broken like:…/events/categories/some-event/?pno=%2525PAGE%2525I think the only change necessary to fix this is adding an additional
falseargument to theem_add_get_paramsfunction call on line 1128 like so:$page_link_template = em_add_get_params($page_url, $page_args_escaped, false, false);Hope you can get a fix out soon and thank you for the awesome plugin!
The topic ‘Pagination URL Encoding Bug’ is closed to new replies.