Issue Type: Bug Created: 2009-06-03T07:45:15.000+0000 Last Updated: 2010-11-20T05:43:42.000+0000 Status: Resolved Fix version(s): Reporter: Vladan Zajda (vladan) Assignee: Ryan Mauger (bittarman) Tags: - Zend_Db
Related issues: Attachments:
There is an unexpected behavior / critical incompatibility using delete method of Zend_Db. When parameter $where is an array('article_id' => 'article_id=123') whole table is emptied instead of deleting a single record with an article_id=123.
$where = array('article_id' => 'article_id=123'); $this->db->delete('MY_TABLE', $where);
ZF 1.7.8: row with article_id=123 is deleted ZF 1.8.2: result: MY_TABLE is emptied
The behavior is caused by the 'string' array key. If numeric key is used the problem is avoid.
Posted by Florent Cailhol (ooflorent) on 2009-06-11T03:35:47.000+0000
In Zend/Db/Adapter/Abstract.php on line 659 you can see this: $term = $this->quoteInto($cond, $term);
Using array('article_id' => 'article_id=123') will cause a where query like "WHERE article_id" without any binding. The correct array binding should be array('article_id = ?' => 123).
In my opinion, if the ZF developer team changes this behavior in order to preverse BC, it will introduce unpredictable results.
Posted by Ryan Mauger (bittarman) on 2010-11-20T05:43:42.000+0000
Closing as not an issue, as noted above, the correct and documented notation would be array('field = ?' => $value)
Have you found an issue?
See the Overview section for more details.