diff --git a/CHANGELOG.md b/CHANGELOG.md index 7586ce41ad..1391e81fa0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,18 +2,24 @@ All notable changes to this project will be documented in this file based on the [Keep a Changelog](http://keepachangelog.com/) Standard. This project adheres to [Semantic Versioning](http://semver.org/). -## [Unreleased](https://github.com/ruflin/Elastica/compare/2.3.1...HEAD) +## [Unreleased](https://github.com/ruflin/Elastica/compare/2.3.2...HEAD) ### Backward Compatibility Breaks ### Bugfixes +- Fixed regression introduced by #1510; the fix was incompatible with PHP > 7 #1572 ### Added ### Improvements ### Deprecated -- In PHP 7.2 count() now raises a warning when an invalid parameter is passed. Only arrays and objects implementing the Countable interface should be passed. Backported from [#1378](https://github.com/ruflin/Elastica/pull/1378) + + +## [2.3.2](https://github.com/ruflin/Elastica/releases/tag/2.3.2) - 2018-10-30 + +### Improvements +- In PHP 7.2 count() now raises a warning when an invalid parameter is passed. Only arrays and objects implementing the Countable interface should be passed. Backported from [#1378](https://github.com/ruflin/Elastica/pull/1378). See #1510 ## [2.3.1](https://github.com/ruflin/Elastica/releases/tag/2.3.1) - 2015-10-17 diff --git a/lib/Elastica/Query.php b/lib/Elastica/Query.php index a91016c1cd..303d92f564 100644 --- a/lib/Elastica/Query.php +++ b/lib/Elastica/Query.php @@ -401,8 +401,12 @@ public function toArray() unset($this->_params['facets']); } - if (isset($this->_params['post_filter']) && 0 === count(($this->_params['post_filter'])->toArray())) { - unset($this->_params['post_filter']); + if (isset($this->_params['post_filter'])) { + $postFilter = $this->_params['post_filter']->toArray(); + + if (0 === count($postFilter)) { + unset($this->_params['post_filter']); + } } $array = $this->_convertArrayable($this->_params);