$this->db->where - Associative array method - escaping error |
|||
|---|---|---|---|
| Date: | 05/14/2007 | Severity: | Critical |
| Status: | Resolved | Reporter: | Thadeus |
| Version: | 1.5.3 | ||
| Keywords: | |||
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
Comment on Bug Report
| Posted by: coolfactor on 14 May 2007 5:21pm | |
|
|
This NULL (PHP’s value) vs NULL (MySQL’s value) has been brought up before. I agree that the Active Record class should translate between them seamlessly. |
| Posted by: Thadeus on 14 May 2007 5:41pm | |
|
|
@coolfactor: |
