diff --git a/phpBB/includes/db/mysql4.php b/phpBB/includes/db/mysql4.php index bde53beab6..ce56efc664 100644 --- a/phpBB/includes/db/mysql4.php +++ b/phpBB/includes/db/mysql4.php @@ -147,7 +147,8 @@ class dbal_mysql4 extends dbal // if $total is set to 0 we do not want to limit the number of rows if ($total == 0) { - $total = -1; + // Because MySQL 4.1+ no longer supports -1 in LIMIT queries we set it to the maximum value + $total = 18446744073709551615; } $query .= "\n LIMIT " . ((!empty($offset)) ? $offset . ', ' . $total : $total); diff --git a/phpBB/includes/db/mysqli.php b/phpBB/includes/db/mysqli.php index 05846c717e..5bd4b124db 100644 --- a/phpBB/includes/db/mysqli.php +++ b/phpBB/includes/db/mysqli.php @@ -145,7 +145,8 @@ class dbal_mysqli extends dbal // if $total is set to 0 we do not want to limit the number of rows if ($total == 0) { - $total = -1; + // MySQL 4.1+ no longer supports -1 in limit queries + $total = 18446744073709551615; } $query .= "\n LIMIT " . ((!empty($offset)) ? $offset . ', ' . $total : $total);