-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix SQL query quoting/casting when type is passed to where function
The $type variable can be both string or int, so before comparing it to 'TYPE_CONDITION' string it has to be casted to avoid comparing integer zero with string (0 == 'TYPE_CONDITION') which will wrongly return true, and remove the information about type. Pass type provided to where function down the chain to allow automatic casting of arrays of values e.g. to int. This fixes following cases: 1) ->where('attr_table.store_id IN (?)', $storeIds, Zend_Db::INT_TYPE); 2) ->where('attr_table.store_id = ?', $storeId, Zend_Db::INT_TYPE); In both cases now passed value is correctly casted to int (either single value, or each value from array) Co-authored-by: Ihor Sviziev <[email protected]>
- Loading branch information
1 parent
39012d4
commit 0118d48
Showing
2 changed files
with
10 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters