Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query Builder - Ensure sending real arrays when filtering in $in cond… #7

Merged
merged 1 commit into from
Oct 30, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* @category Smile
* @package Smile_MongoCore
* @author Aurelien FOUCRET <aurelien.foucret@smile.fr>
* @author Romain RUAUD <romain.ruaud@smile.fr>
* @copyright 2013 Smile (http://www.smile-oss.com/)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
Expand All @@ -43,6 +44,15 @@ public function getIdsFilter($ids)
$ids[$position] = new MongoInt32($entityId);
}

/**
* Since version 2.6, MongoDB is attending real array in $in condition
* Ensure sending real arrays when filtering, otherwise, associative or non-sequential arrays are considered
* as BSON objects and cause exception.
*
* @see https://jira.mongodb.org/browse/PHP-1051
*/
$ids = array_values($ids);

$result = array('_id' => array('$in' => $ids));

} else {
Expand Down