From 8445174d134a37d921ee07ff1289e44dcc6a47db Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 28 Apr 2021 08:18:19 -0500 Subject: [PATCH] cast to int --- Query/Grammars/SqlServerGrammar.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Query/Grammars/SqlServerGrammar.php b/Query/Grammars/SqlServerGrammar.php index f0a0bfc51..88a7df3dc 100755 --- a/Query/Grammars/SqlServerGrammar.php +++ b/Query/Grammars/SqlServerGrammar.php @@ -60,8 +60,8 @@ protected function compileColumns(Builder $query, $columns) // If there is a limit on the query, but not an offset, we will add the top // clause to the query, which serves as a "limit" type clause within the // SQL Server system similar to the limit keywords available in MySQL. - if ($query->limit > 0 && $query->offset <= 0) { - $select .= 'top '.$query->limit.' '; + if (is_numeric($query->limit) && $query->limit > 0 && $query->offset <= 0) { + $select .= 'top '.((int) $query->limit).' '; } return $select.$this->columnize($columns); @@ -221,10 +221,10 @@ protected function compileTableExpression($sql, $query) */ protected function compileRowConstraint($query) { - $start = $query->offset + 1; + $start = (int) $query->offset + 1; if ($query->limit > 0) { - $finish = $query->offset + $query->limit; + $finish = (int) $query->offset + (int) $query->limit; return "between {$start} and {$finish}"; }