Skip to content

Commit

Permalink
Fix ruflin#1559 - Backported from ruflin#1561 (ruflin#1572)
Browse files Browse the repository at this point in the history
* Fix ruflin#1559 - Backported from ruflin#1561
  • Loading branch information
jmsche authored and p365labs committed Jan 11, 2019
1 parent b229ddd commit 2926265
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions lib/Elastica/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2926265

Please sign in to comment.