From: Marcin Haba Date: Fri, 9 Dec 2022 12:30:34 +0000 (+0100) Subject: baculum: Fix OFFSET parameter in PHP framework X-Git-Tag: Release-13.0.2~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ead6c5b43dff4d0a1a4ec88a520fa32d74707206;p=thirdparty%2Fbacula.git baculum: Fix OFFSET parameter in PHP framework Ticket in the PRADO framework GitHub project: Support for OFFSET parameter without LIMIT clause in SQL query for TActiveRecord https://github.com/pradosoft/prado/issues/819 --- diff --git a/gui/baculum/protected/vendor/pradosoft/prado/framework/Data/DataGateway/TSqlCriteria.php b/gui/baculum/protected/vendor/pradosoft/prado/framework/Data/DataGateway/TSqlCriteria.php index 4d0acc220..07a20508a 100644 --- a/gui/baculum/protected/vendor/pradosoft/prado/framework/Data/DataGateway/TSqlCriteria.php +++ b/gui/baculum/protected/vendor/pradosoft/prado/framework/Data/DataGateway/TSqlCriteria.php @@ -144,7 +144,7 @@ class TSqlCriteria extends \Prado\TComponent // [LIMIT {[offset,] row_count | row_count OFFSET offset}] // See: http://dev.mysql.com/doc/refman/5.0/en/select.html - if (preg_match('/ORDER\s+BY\s+(.*?)(?=LIMIT)|ORDER\s+BY\s+(.*?)$/i', $value, $matches) > 0) { + if (preg_match('/ORDER\s+BY\s+(.*?)(?=\s+(?:LIMIT|OFFSET))|ORDER\s+BY\s+(.*?)$/i', $value, $matches) > 0) { // condition contains ORDER BY $value = str_replace($matches[0], '', $value); if (strlen($matches[1]) > 0) {