If someone externally links a truncated URL, for example:
http://www.example.com/node/380?from=100&comments_per_page
or if someone deliberately passes zero as a parameter:
http://www.example.com/node/380?from=100&comments_per_page=0
then it is possible for the pages to be passed zero as a parameter, which will result in a divide by zero, and spam in the logs.
Workaround:
In file: "includes/pager.inc"
in function: "pager_query"
I inserted as follows:
function pager_query($query, $limit = 10, $element = 0, $count_query = NULL) {
global $pager_page_array, $pager_total, $pager_total_items;
if (empty($limit)) { $limit=10; } // Avoid divide by zero - Dewi.
$page = isset($_GET['page']) ? $_GET['page'] : '';
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 23465.patch | 504 bytes | neclimdul |
Comments
Comment #1
neclimdulQuick patch based on this. Slightly different but smaller.
Apologies for the patch being from git but cvs wasn't responding.
Comment #2
tr commentedIssue does not occur in 8.x or 7.x. DBTNG disables the pager entirely if limit is 0, FALSE, or NULL. (See PagerDefault->limit() and PagerDefault->execute() in includes/pager.inc)
However, issue is still present in 6.x, so I'm moving this to the 6.x queue for consideration.
Patch applies and works to address the issue raised by the original poster. My only question would be whether the limit should default to 10 if it's missing or zero (which is what the patch currently does), or whether the behavior should be to disable the pager like in 8.x and 7.x.
Comment #3
tr commented#1: 23465.patch queued for re-testing.