Ticket #26 (closed Bug: fixed)

Opened 16 months ago

Last modified 16 months ago

$this->db->where - Associative array method - escaping error

Reported by: zombor Owned by: zombor
Priority: minor Milestone: 1.0
Component: Version:
Keywords: database, active record Cc:

Description

Description

the method mentioned above produces errors, as it is not escaping correctly and when an array value is empty it should use NULL as a value, but instead it puts nothing, which breaks the sql statement. Code Sample

$somearray
(
    [0] => 3
    [1] => 1
    [2] =>
    [3] =>
    [4] =>
    [5] =>
)

applying this array to the function:
$this->db->where('table', $somearray)

Expected Result

SELECT * FROM table WHERE 0 = ‘3’ AND 1 = ‘1’ AND 2 = ‘2’ AND 3 =NULL AND 4=NULL AND 5=NULL

Actual Result

SELECT * FROM table WHERE 0 = ‘3’ AND 1 = ‘1’ AND 2 = 2 AND 3 AND 4 AND 5

Change History

Changed 16 months ago by zombor

  • status changed from new to closed
  • resolution set to fixed

Fixed in r46

Note: See TracTickets for help on using tickets.