PHP 7.3 will deprecate FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED
src/Elasticsearch/ClientBuilder.php#L674
/**
* @param string $host
*
* @return string
*/
private function prependMissingScheme($host)
{
if (!filter_var($host, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED)) {
$host = 'http://' . $host;
}
return $host;
}
This function probably requires a php version check. In php 7.2 and later the flag can be omitted It's 5.2, not 7.2. Just remove it
Guys, any word on this. Just upgraded to PHP 7.3 and now my elasticsearch is broken.
@robtesch do you have any other problems? This should be only a deprecation warning
I'm using this package with a Laravel installation and it seems Laravel is converting the warning to an ErrorException. This may be what Rob is experiencing as well.
@sandfoxme Sorry, yes, i should have provided some more context. As @gregharmontn has mentioned, I am using elasticsearch in a Laravel app in conjunction with https://github.com/laravel/scout and https://github.com/babenkoivan/scout-elasticsearch-driver. This combination seems to be converting the deprecation warning to an ErrorException, meaning I cannot use php7.3 at this time if i want to keep using elasticsearch.
EDIT: fixed links
A pull request is already proposed: https://github.com/elastic/elasticsearch-php/pull/823
@gregharmontn @robtesch Thanks. I was afraid there were some more troubles
@juherr seems to be a duplicate of #803. Anyway, neither of them is merged :(
Will patiently await a merge and release then... many thanks for the help so far.
Need this fix also for older versions of the client so I did port it into the ES2 #825, ES5 #826, ES6 #827 client branches. Did also add php 7.3 to the test matrix so future errors should be avoided.
Merged fix into master, will merge the other branches where appropriate. Need to do a few other much-needed updates (for recent ES versions), then will tag and release before end of day.
So so sorry for the delay on this! My dev time has been increasingly pulled away from the client to core ES work, hence the lack of progress here.
But good news, we've hired someone who will be taking over the PHP client (and other client responsibilities), so PHP-land should be getting a lot more love soon. Thanks for your patience!
So happy to hear that! Just waiting for this release to be able to fully upgrade do php 7.3
Hey folks, versions 6.1.0, 5.4.0, and 2.4.0 tagged and pushed which include the PHP 7.3 changes.
Thanks again for your patience :)
Hi there @polyfractal, thanks so much for all the work. In my project, the elasticsearch-php package is a sub-dependency, so in order to force an update to 6.1 I tried to simply add it to my dependencies directly, using "^6.1.0" as the version constraint. Unfortunately it doesn't appear that this release is on packagist. Am i perhaps doing something wrong here?
Edit for clarity: "elasticsearch/elasticsearch": "^6.1.0" is what i have in my composer.json
Edit 2: Seems i was just being impatient, packagist seems to have it now. Sorry for the useless comment!
@robtesch no worries at all, it was a problem on our side (https://github.com/elastic/elasticsearch-php/issues/830). The repo has/had an outdated webhook which caused Packagist to stop updating. I kicked off a manual update and we're installing the new webhook now :)
"elasticsearch/elasticsearch": "^6.1.0" 锛宼his works!
Most helpful comment
Hey folks, versions
6.1.0,5.4.0, and2.4.0tagged and pushed which include the PHP 7.3 changes.Thanks again for your patience :)