Skip to content

Commit

Permalink
cast to int for safety. grammar already does so this is just extre pr…
Browse files Browse the repository at this point in the history
…ecaution.
  • Loading branch information
taylorotwell committed Nov 16, 2021
1 parent fe54e00 commit 62273d2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2102,7 +2102,7 @@ public function limit($value)
$property = $this->unions ? 'unionLimit' : 'limit';

if ($value >= 0) {
$this->$property = $value;
$this->$property = (int) $value;
}

return $this;
Expand Down

2 comments on commit 62273d2

@jvittetoe
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to change the expected query results anytime null is passed to the ->limit(null) function. As is the case within Nova core. This change has broken a bunch of our BelongsTo nova fields.

if ($value >= 0 && null !== $value) {
    $this->$property = $value;
    $this->$property = (int) $value;
}

@KennedyTedesco
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jvittetoe I believe this was already fixed.

Please sign in to comment.