php es包报错:"filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_

1.出现这个问题的缘由是 PHP7.3 的 filter_var() 函数放弃了对这两个参数的支持。php

/**
 * @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;
}
复制代码

php 官方文档log以下: www.php.net/manual/en/f…laravel

因此当咱们的 PHP version >= 7.3 时,使用 elasticsearch 的composer 包就会报这个错:git

filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecatedgithub

2.那么如何修复这个问题呢?一样在 elasticsearch-PHP 的官方开源包里也给了答案。json

有兴趣能够看下这个讨论帖:bash

github.com/summerblue/…composer

咱们将 composer.json 里的 elasticsearch 版本设置为 '^6.1.0' 就不会报这个错了。elasticsearch

"elasticsearch/elasticsearch": "^6.1.0",函数

composer up -vvv 更新一遍包就好了。ui

祝你们 coding 愉快~

相关文章
相关标签/搜索