Skip to content

Commit d7d52fa

Browse files
committed
prevent duplicate LIMIT in sql-class - Fixes #4384
1 parent 8b1e0d0 commit d7d52fa

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

interface/lib/classes/db_mysql.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ public function query($sQuery = '') {
314314
* @return array result row or NULL if none found
315315
*/
316316
public function queryOneRecord($sQuery = '') {
317-
if(!preg_match('/limit \d+\s*,\s*\d+$/i', $sQuery)) $sQuery .= ' LIMIT 0,1';
317+
if(!preg_match('/limit \d+\s*(,\s*\d+)?$/i', $sQuery)) $sQuery .= ' LIMIT 0,1';
318318

319319
$aArgs = func_get_args();
320320
$oResult = call_user_func_array(array(&$this, 'query'), $aArgs);

server/lib/classes/db_mysql.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ public function query($sQuery = '') {
278278
* @return array result row or NULL if none found
279279
*/
280280
public function queryOneRecord($sQuery = '') {
281-
if(!preg_match('/limit \d+\s*,\s*\d+$/i', $sQuery)) $sQuery .= ' LIMIT 0,1';
281+
if(!preg_match('/limit \d+\s*(,\s*\d+)?$/i', $sQuery)) $sQuery .= ' LIMIT 0,1';
282282

283283
$aArgs = func_get_args();
284284
$oResult = call_user_func_array(array(&$this, 'query'), $aArgs);

0 commit comments

Comments
 (0)