Skip to content

Commit

Permalink
FIX : FATAL ERROR abusively triggered due to incomplete regex (#31052)
Browse files Browse the repository at this point in the history
* Fix regex detection

* New regular expression to include offset
  • Loading branch information
thersane-john authored Sep 26, 2024
1 parent 25c4f5b commit 25754d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion htdocs/core/db/DoliDB.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ public function getRow($sql)
*/
public function getRows($sql)
{
if (!preg_match('/LIMIT \d+$/', $sql)) {
if (!preg_match('/LIMIT \d+(?:(?:,\ *\d*)|(?:\ +OFFSET\ +\d*))?\ *;?$/', $sql)) {
trigger_error(__CLASS__ .'::'.__FUNCTION__.'() query must have a LIMIT clause', E_USER_ERROR);
}

Expand Down

0 comments on commit 25754d8

Please sign in to comment.