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

PHP7 Compatibility #140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -3121,7 +3121,7 @@ public function whois($oneNode = null) {
.($node->getAttribute('id')
? '#'.$node->getAttribute('id'):'')
.($node->getAttribute('class')
? '.'.join('.', split(' ', $node->getAttribute('class'))):'')
? '.'.join('.', preg_split(' ', $node->getAttribute('class'))):'')
.($node->getAttribute('name')
? '[name="'.$node->getAttribute('name').'"]':'')
.($node->getAttribute('value') && strpos($node->getAttribute('value'), '<'.'?php') === false
Expand Down
92 changes: 67 additions & 25 deletions vendor/ruflin/elastica/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,62 @@
# Change Log
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/3.1.1...HEAD)
## [Unreleased](https://github.com/ruflin/Elastica/compare/3.2.1...HEAD)

### Backward Compatibility Fixes

### Bugfixes
- Set HTTP headers on each request preventing server error if persistent connection is enabled and compression enabled and later disabled for the same connection.

### Added
- Elastica\QueryBuilder\DSL\Query::geo_distance

### Improvements
- Set PHP 7.0 as default development version
- Get the root reason from Elasticsearch's error JSON, when available [#1111](https://github.com/ruflin/Elastica/pull/1111)

## [3.2.1](https://github.com/ruflin/Elastica/compare/3.2.0...3.2.1)

### Backward Compatibility Fixes
- Reintroduced properties in ResultSet removed in 3.2.0 as deprecated properties to be removed in 4.0

### Bugfixes
- Fix fatal error on `Query::addScriptField()` if scripts were already set via `setScriptFields()` [#1086](https://github.com/ruflin/Elastica/pull/1086)
- Fix namespace collision of `Type` in `Query\Ids` [#1104](https://github.com/ruflin/Elastica/pull/1104)

### Added
- Added the concept of ResultSet Transformers. The Transformer adds more information to a Result, for example the original object or data that created the Result. [#1066](https://github.com/ruflin/Elastica/pull/1066)
- Tidied property initialisation in classes where it was duplicated

## [3.2.0](https://github.com/ruflin/Elastica/compare/3.1.1...3.2.0)

### Backward Compatibility Breaks
- Method \Elastica\ResultSet::create and property \Elastica\ResultSet::$class were removed. To change the ResultSet class, implement your own ResultSet Builder. [#1065](https://github.com/ruflin/Elastica/pull/1065)
- Properties on \Elastica\ResultSet _totalHits, _maxScore, _took and _timedOut that were originally set on object construction are now accessed by the getters on the ResultSet. [#1065](https://github.com/ruflin/Elastica/pull/1065)

### Bugfixes
- Fix php notice on `\Elastica\Index::getAliases()` if index has no aliases [#1078](https://github.com/ruflin/Elastica/issues/1078)

### Added
- Update elasticsearch build dependency to elasticsearch 2.3.2 [#1084](https://github.com/ruflin/Elastica/pull/1084)

### Improvements
- `Elastica\Type->deleteByQuery($query, $options)` $query param can be a query `array` again https://github.com/ruflin/Elastica/issues/1072 [#1073](https://github.com/ruflin/Elastica/pull/1073)
- `Elastica\Client->connect()` allows to establish a connection to ES server when the config was set using method `Elastica\Client->setConfigValue()` https://github.com/ruflin/Elastica/issues/1076 [#1077](https://github.com/ruflin/Elastica/pull/1077)
- Elastica\Client constructor now accepts a LoggerInterface and will log both successful and failed requests. [#1069](https://github.com/ruflin/Elastica/pull/1069)

### Deprecated
- Configuring the logger in \Elastica\Client $config constructor is deprecated and will be removed. Use the $logger argument instead. [#1069](https://github.com/ruflin/Elastica/pull/1069)
- Extracted creation of ResultSet objects to a new dedicated ResultSet\Builder implementation. [#1065](https://github.com/ruflin/Elastica/pull/1065)

### Deprecated
- All properties in the \Elastica\ResultSet class will be moved to private in 4.0. To manipulate the creation of a ResultSet, implement the \Elastica\ResultSet\BuilderInterface and pass your new Builder to the \Elastica\Search instances. [#1065](https://github.com/ruflin/Elastica/pull/1065)


## [3.1.1](https://github.com/ruflin/Elastica/compare/3.1.0...3.1.1)

### Added
- Add an "AwsAuthV4" transport that automatically signs requests using credentials from the environment or from the client config. This allows using Elastica with Amazon ElasticSearch Service domains that are restricted to IAM roles or policies. https://github.com/ruflin/Elastica/pull/1056
- Add an "AwsAuthV4" transport that automatically signs requests using credentials from the environment or from the client config. This allows using Elastica with Amazon ElasticSearch Service domains that are restricted to IAM roles or policies. [#1056](https://github.com/ruflin/Elastica/pull/1056)
- Update elasticsearch build dependency to elasticsearch 2.2.1

### Improvements
Expand Down Expand Up @@ -48,8 +87,8 @@ All notable changes to this project will be documented in this file based on the
## [3.0.1](https://github.com/ruflin/Elastica/compare/3.0.0...3.0.1)

### Improvements
- Update build dependency to elasticsearch 2.1.1 #1022
- Readd \Elastica\Filter\Nested. See https://github.com/ruflin/Elastica/issues/1001 #1020
- Update build dependency to elasticsearch 2.1.1 [#1022](https://github.com/ruflin/Elastica/pull/1022)
- Readd \Elastica\Filter\Nested. See https://github.com/ruflin/Elastica/issues/1001 [#1020](https://github.com/ruflin/Elastica/pull/1020)


## [3.0.0](https://github.com/ruflin/Elastica/compare/3.0.0-beta1...3.0.0)
Expand All @@ -58,10 +97,10 @@ All notable changes to this project will be documented in this file based on the
- Revert getError changes in Response object and make it better BC compatible. See comment [here](https://github.com/ruflin/Elastica/commit/41a7a2075837320bc9bd3bca4150e05a1ec9a115#commitcomment-15136374).

### Bugfixes
- Function score query: corrected the `score_method` `average` to `avg` #975
- Set `json_decode()` assoc parameter to true in `Elastica\Response` #1005
- Add `bigintConversion` to keys passed to connection config in `Elastica\Client` #1005
- Use POST instead of PUT to send bulk requests #1010
- Function score query: corrected the `score_method` `average` to `avg` [#975](https://github.com/ruflin/Elastica/pull/975)
- Set `json_decode()` assoc parameter to true in `Elastica\Response` [#1005](https://github.com/ruflin/Elastica/pull/1005)
- Add `bigintConversion` to keys passed to connection config in `Elastica\Client` [#1005](https://github.com/ruflin/Elastica/pull/1005)
- Use POST instead of PUT to send bulk requests [#1010](https://github.com/ruflin/Elastica/issues/1010)

### Added
- Elastica\Query\MultiMatch::setFuzziness now supports being set to `AUTO` with the const `MultiMatch::FUZZINESS_AUTO`
Expand All @@ -70,7 +109,7 @@ All notable changes to this project will be documented in this file based on the

### Improvements
- More info on Elastica\Exception\PartialShardFailureException. Not just number of failed shards.
- Allow bool in TopHits::setSource function #1012
- Allow bool in TopHits::setSource function [#1012](https://github.com/ruflin/Elastica/issues/1012)

### Deprecated
- Elastica\Query\Filtered triggers E_USER_DEPRECATED error because filtered query is deprecated since ES 2.0.0-beta1. Use BoolQuery instead.
Expand Down Expand Up @@ -136,18 +175,18 @@ All notable changes to this project will be documented in this file based on the
## [2.3.1](https://github.com/ruflin/Elastica/releases/tag/2.3.1) - 2015-10-17

### Bugfixes
- Filters aggregation: empty name is named bucket #935
- Prevent mix keys in filters (#936) #939
- Fix empty string is not anonymous filter #935
- Filters aggregation: empty name is named bucket #935
- Filters aggregation: empty name is named bucket [#935](https://github.com/ruflin/Elastica/pull/935)
- Prevent mix keys in filters ([#936](https://github.com/ruflin/Elastica/pull/936)) [#939](https://github.com/ruflin/Elastica/pull/939)
- Fix empty string is not anonymous filter [#935](https://github.com/ruflin/Elastica/pull/935)
- Filters aggregation: empty name is named bucket [#935](https://github.com/ruflin/Elastica/pull/935)

### Added
- Support for field_value_factor #953
- Added setMinDocCount and setExtendedBounds options #947
- Avoid environment dependecies in tests #938
- Support for field_value_factor [#953](https://github.com/ruflin/Elastica/pull/953)
- Added setMinDocCount and setExtendedBounds options [#947](https://github.com/ruflin/Elastica/pull/947)
- Avoid environment dependecies in tests [#938](https://github.com/ruflin/Elastica/pull/938)

### Improvements
- Update elasticsearch dependency to elasticsearch 1.7.3 #957
- Update elasticsearch dependency to elasticsearch 1.7.3 [#957](https://github.com/ruflin/Elastica/pull/957)

### Deprecated
- Added exceptions of deprecated transports to deprecation list
Expand All @@ -162,10 +201,10 @@ All notable changes to this project will be documented in this file based on the
as argument. [#916](https://github.com/ruflin/Elastica/pull/916)

### Added
- Add Script File feature #902 #914
- Add Script File feature [#902](https://github.com/ruflin/Elastica/pull/902) [#914](https://github.com/ruflin/Elastica/pull/914)

### Improvements
- Support the http.compression in the Http transport adapter #515
- Support the http.compression in the Http transport adapter [#515](https://github.com/ruflin/Elastica/issues/515)
- Introduction of Lazy toArray [#916](https://github.com/ruflin/Elastica/pull/916)
- Update Elasticsearch dependency to 1.7.2 [#929](https://github.com/ruflin/Elastica/pull/929)

Expand Down Expand Up @@ -219,17 +258,17 @@ All notable changes to this project will be documented in this file based on the
- Support for a custom connection timeout through a connectTimeout parameter. [#841](https://github.com/ruflin/Elastica/issues/841/)
- SignificantTerms Aggregation [#847](https://github.com/ruflin/Elastica/issues/847/)
- Support for 'precision_threshold' and 'rehash' options for the Cardinality Aggregation [#851]
- Support for retrieving id node #852
- Support for retrieving id node [#852](https://github.com/ruflin/Elastica/pull/852)
- Scroll Iterator [#842](https://github.com/ruflin/Elastica/issues/842/)
- Gitter Elastica Chat Room add for Elastica discussions: https://gitter.im/ruflin/Elastica
- Introduce PHP7 compatibility and tests. #837
- Introduce PHP7 compatibility and tests. [#837](https://github.com/ruflin/Elastica/pull/837)
- `Tool\CrossIndex` for reindexing and copying data and mapping between indices [#853](https://github.com/ruflin/Elastica/pull/853)
- CONTIRUBTING.md file added for contributor guidelines. #854
- CONTIRUBTING.md file added for contributor guidelines. [#854](https://github.com/ruflin/Elastica/pull/854)

### Improvements
- Introduction of Changelog standard based on http://keepachangelog.com/. changes.txt moved to CHANGELOG.md [#844](https://github.com/ruflin/Elastica/issues/844/)
- Make host for all tests dynamic to prepare it for a more dynamic test environment #846
- Node information is retrieved based on id instead of name as multiple nodes can have the same name. #852
- Make host for all tests dynamic to prepare it for a more dynamic test environment [#846](https://github.com/ruflin/Elastica/pull/846)
- Node information is retrieved based on id instead of name as multiple nodes can have the same name. [#852](https://github.com/ruflin/Elastica/pull/852)
- Guzzle Http dependency updated to 5.3.*
- Remove NO_DEV builds from travis build matrix to speed up building. All builds include no dev packages.
- Introduction of benchmark test group to make it easy to run benchmark tests.
Expand All @@ -242,7 +281,7 @@ All notable changes to this project will be documented in this file based on the
### Deprecated
- Facets are deprecated. You are encouraged to migrate to aggregations instead. [#855](https://github.com/ruflin/Elastica/pull/855/)
- Elastica\Query\Builder is deprecated. Use new Elastica\QueryBuilder instead. [#855](https://github.com/ruflin/Elastica/pull/855/)
- For PHP 7 compatibility Elastica\Query\Bool was renamed to *\BoolQuery, Elastica\Filter\Bool was renamed to BoolFilter, Elastica\Transport\Null was renamed to NullTransport as Null and Bool are reserved phrases in PHP 7. Proxy objects for all three exist to keep backward compatibility. It is recommended to start using the new objects as the proxy classes will be deprecated as soon as PHP 7 is stable. #837
- For PHP 7 compatibility Elastica\Query\Bool was renamed to *\BoolQuery, Elastica\Filter\Bool was renamed to BoolFilter, Elastica\Transport\Null was renamed to NullTransport as Null and Bool are reserved phrases in PHP 7. Proxy objects for all three exist to keep backward compatibility. It is recommended to start using the new objects as the proxy classes will be deprecated as soon as PHP 7 is stable. [#837](https://github.com/ruflin/Elastica/pull/837)



Expand Down Expand Up @@ -1210,3 +1249,6 @@ The changelog before version 2.0.0 was organised by date. All changes can be fou
- getResponse in Elastica_Response renamed to getData. getResponse now deprecated
- Index status objects added
- getIndexName in Elastica_Index renamed to getName. getIndexName is deprecated

2011-03-21
- ChildrenAggregation added - https://www.elastic.co/guide/en/elasticsearch/guide/current/children-agg.html
2 changes: 1 addition & 1 deletion vendor/ruflin/elastica/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#/bin/bash

SOURCE = "./lib"
TARGET?=56
TARGET?=70

# By default docker environment is used to run commands. To run without the predefined environment, set RUN_ENV=" " either as parameter or as environment variable
ifndef RUN_ENV
Expand Down
4 changes: 2 additions & 2 deletions vendor/ruflin/elastica/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ All library issues should go to the [issue tracker from github](https://github.c

Compatibility
-------------
This release is compatible with all elasticsearch 2.x releases. It was tested with version 2.2.1
This release is compatible with all elasticsearch 2.x releases. It was tested with version 2.3.2


Contributing
Expand All @@ -29,5 +29,5 @@ Dependencies
------------
| Project | Version | Required |
|---------|---------|----------|
|[Elasticsearch](https://github.com/elasticsearch/elasticsearch/tree/v2.2.1)|2.2.1|yes|
|[Elasticsearch](https://github.com/elasticsearch/elasticsearch/tree/v2.3.2)|2.3.2|yes|
|[Elasticsearch image plugin](https://github.com/Jmoati/elasticsearch-image/releases/tag/1.7.1)|1.7.1|no|
12 changes: 6 additions & 6 deletions vendor/ruflin/elastica/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
"psr/log": "~1.0"
},
"require-dev": {
"guzzlehttp/guzzle": "~6.0",
"aws/aws-sdk-php": "~3.0"
"aws/aws-sdk-php": "~3.0",
"guzzlehttp/guzzle": "~6.0"
},
"suggest": {
"guzzlehttp/guzzle": "Allow using guzzle 6 as the http transport (Requires php 5.5)",
"aws/aws-sdk-php": "Allow using IAM authentication with Amazon ElasticSearch Service",
"egeloen/http-adapter": "Allow using httpadapter transport",
"monolog/monolog": "Logging request",
"aws/aws-sdk-php": "Allow using IAM authentication with Amazon ElasticSearch Service"
"guzzlehttp/guzzle": "Allow using guzzle 6 as the http transport (Requires php 5.5)",
"monolog/monolog": "Logging request"
},
"autoload": {
"psr-4": {
Expand All @@ -37,7 +37,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "3.1.x-dev"
"dev-master": "3.2.x-dev"
}
}
}
2 changes: 1 addition & 1 deletion vendor/ruflin/elastica/docker-entrypoint.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ readParams() {
# green or yellow.
waitForElasticsearch() {
echo -n "Waiting on elasticsearch(${ES_HOST}:${ES_PORT}) to start."
for ((i=1;i<=30;i++))
for ((i=1;i<=60;i++))
do
health=$(curl --silent "http://${ES_HOST}:${ES_PORT}/_cat/health" | awk '{print $4}')
if [[ "$health" == "green" ]] || [[ "$health" == "yellow" ]]
Expand Down
10 changes: 7 additions & 3 deletions vendor/ruflin/elastica/env/elastica/Docker54
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ RUN apt-get update && apt-get install -y \
graphviz \
libxslt-dev \
nano \
php5-xsl
php5-xsl \
wget
# XSL and Graphviz for PhpDocumentor

RUN docker-php-ext-install sockets xsl
Expand All @@ -24,10 +25,13 @@ RUN pecl install xdebug-2.3.2
RUN echo "memory_limit=1024M" >> /usr/local/etc/php/conf.d/memory-limit.ini
RUN echo "date.timezone=UTC" >> /usr/local/etc/php/conf.d/timezone.ini
#RUN echo "extension=/usr/lib/php5/20131226/xsl.so" >> /usr/local/etc/php/conf.d/xsl.ini # TODO: Debian is putting the xsl extension in a different directory, should be in: /usr/local/lib/php/extensions/no-debug-non-zts-20131226
RUN echo "zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so" >> /usr/local/etc/php/conf.d/xdebug.ini
RUN echo "zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so" >> /usr/local/etc/php/conf.d/xdebug.ini

# Install and setup composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN wget https://getcomposer.org/download/1.0.3/composer.phar
RUN mv composer.phar /usr/local/bin/composer
RUN chmod a+x /usr/local/bin/composer

ENV COMPOSER_HOME /root/composer

# Add composer bin to the environment
Expand Down
8 changes: 4 additions & 4 deletions vendor/ruflin/elastica/env/elastica/Docker70
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ RUN apt-get update && apt-get install -y \
graphviz \
libxslt-dev \
nano \
php5-xsl
php5-xsl \
zip unzip
# XSL and Graphviz for PhpDocumentor

RUN docker-php-ext-install sockets xsl

RUN rm -r /var/lib/apt/lists/*

# Xdebug for coverage report
RUN pecl install xdebug-2.3.2
RUN pecl install xdebug-2.4.0

## PHP Configuration

RUN echo "memory_limit=1024M" >> /usr/local/etc/php/conf.d/memory-limit.ini
RUN echo "date.timezone=UTC" >> /usr/local/etc/php/conf.d/timezone.ini
#RUN echo "extension=/usr/lib/php5/20131226/xsl.so" >> /usr/local/etc/php/conf.d/xsl.ini # TODO: Debian is putting the xsl extension in a different directory, should be in: /usr/local/lib/php/extensions/no-debug-non-zts-20131226
RUN echo "zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so" >> /usr/local/etc/php/conf.d/xdebug.ini
RUN echo "zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so" >> /usr/local/etc/php/conf.d/xdebug.ini

# Install and setup composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
Expand Down
2 changes: 1 addition & 1 deletion vendor/ruflin/elastica/env/elasticsearch/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM elasticsearch:2.2.1
FROM elasticsearch:2.3.2
MAINTAINER Nicolas Ruflin <[email protected]>

# Dependencies
Expand Down
1 change: 0 additions & 1 deletion vendor/ruflin/elastica/lib/Elastica/AbstractScript.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

namespace Elastica;

use Elastica\Script\AbstractScript as BaseAbstractScript;
Expand Down
15 changes: 7 additions & 8 deletions vendor/ruflin/elastica/lib/Elastica/AbstractUpdateAction.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

namespace Elastica;

use Elastica\Exception\DeprecatedException;
Expand Down Expand Up @@ -78,7 +77,7 @@ public function hasTtl()
/**
* Sets the document type name.
*
* @param string $type Type name
* @param Type|string $type Type name
*
* @return $this
*/
Expand Down Expand Up @@ -107,7 +106,7 @@ public function getType()
/**
* Sets the document index name.
*
* @param string $index Index name
* @param Index|string $index Index name
*
* @return $this
*/
Expand Down Expand Up @@ -168,7 +167,7 @@ public function hasVersion()
* Sets the version_type of a document
* Default in ES is internal, but you can set to external to use custom versioning.
*
* @param int $versionType Document version type
* @param string $versionType Document version type
*
* @return $this
*/
Expand Down Expand Up @@ -458,7 +457,7 @@ public function getTimeout()
}

/**
* @return string
* @return bool
*/
public function hasTimeout()
{
Expand All @@ -484,7 +483,7 @@ public function getConsistency()
}

/**
* @return string
* @return bool
*/
public function hasConsistency()
{
Expand Down Expand Up @@ -552,10 +551,10 @@ public function hasUpsert()
*
* @return array
*/
public function getOptions(array $fields = array(), $withUnderscore = false)
public function getOptions(array $fields = [], $withUnderscore = false)
{
if (!empty($fields)) {
$data = array();
$data = [];
foreach ($fields as $field) {
$key = '_'.ltrim($field, '_');
if ($this->hasParam($key) && '' !== (string) $this->getParam($key)) {
Expand Down
Loading