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 deprecated
github
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 愉快~