Welcome Guest, Not a member yet? Register   Sign In
CI2.1.3 Limit bug?
#1

[eluser]ladooboy[/eluser]
I've upgraded from CI2.0.2 to CI2.1.3 and noticed that all queries with an EMPTY string or FALSE value for limit would get a "limit 0" on the end of every query.

Code:
public function limit($value, $offset = '')
{
  $this->ar_limit = (int) $value;

  if ($offset != '')
  {
   $this->ar_offset = (int) $offset;
  }

  return $this;
}

The reason is this line
Code:
$this->ar_limit = (int) $value;

If you pass FALSE or EMPTY STRING it will convert the $value to a 0 and limit every query to zero results. Same problem for offset.

I've removed the (int) conversion for LIMIT and OFFSET for now, which has fixed the issue.
#2

[eluser]InsiteFX[/eluser]
It's not a bug you are suppose to be passing integer values to the limit cause.
#3

[eluser]ladooboy[/eluser]
I was using it for counting results with where conditions.

I guess I can use this method from now on: $this->db->count_all_results();

Thanks for the reply.




Theme © iAndrew 2016 - Forum software by © MyBB