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

Lines changed: 4 additions & 4 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy