mirror of
https://codeberg.org/vlw/php-mysql.git
synced 2025-09-13 16:23:42 +02:00
fix: $offset
not set when passing integer to $limit
in limit()
(#50)
This PR just sets the `OFFSET` value to `0` if no offset is provided for all calls to `limit()`. This fixes a bug where no `OFFSET` was set if the `$limit` parameter was given an integer.. which was the only allowed type except null anyways. Reviewed-on: https://codeberg.org/vlw/php-mysql/pulls/50
This commit is contained in:
parent
e062930c41
commit
ddcd8a2961
1 changed files with 2 additions and 11 deletions
|
@ -163,17 +163,8 @@
|
|||
return $this;
|
||||
}
|
||||
|
||||
// Set LIMIT without range directly as integer
|
||||
if (is_int($limit)) {
|
||||
$this->limit = $limit;
|
||||
return $this;
|
||||
}
|
||||
|
||||
// No offset defined, set limit property directly as string
|
||||
if (is_null($offset)) {
|
||||
$this->limit = (string) $limit;
|
||||
return $this;
|
||||
}
|
||||
// Coerce offset to zero if no offset is defined
|
||||
$offset = $offset ?? 0;
|
||||
|
||||
// Set limit and offset as SQL CSV
|
||||
$this->limit = "{$offset},{$limit}";
|
||||
|
|
Loading…
Add table
Reference in a new issue