Skip to content

Commit 09bf145

Browse files
committed
cast to int
1 parent 74a79b2 commit 09bf145

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ protected function compileColumns(Builder $query, $columns)
6060
// If there is a limit on the query, but not an offset, we will add the top
6161
// clause to the query, which serves as a "limit" type clause within the
6262
// SQL Server system similar to the limit keywords available in MySQL.
63-
if ($query->limit > 0 && $query->offset <= 0) {
64-
$select .= 'top '.$query->limit.' ';
63+
if (is_numeric($query->limit) && $query->limit > 0 && $query->offset <= 0) {
64+
$select .= 'top '.((int) $query->limit).' ';
6565
}
6666

6767
return $select.$this->columnize($columns);
@@ -221,10 +221,10 @@ protected function compileTableExpression($sql, $query)
221221
*/
222222
protected function compileRowConstraint($query)
223223
{
224-
$start = $query->offset + 1;
224+
$start = (int) $query->offset + 1;
225225

226226
if ($query->limit > 0) {
227-
$finish = $query->offset + $query->limit;
227+
$finish = (int) $query->offset + (int) $query->limit;
228228

229229
return "between {$start} and {$finish}";
230230
}

0 commit comments

Comments
 (0)