phpbrewで`phpbrew known --update`出来なかったときの対応

TL;DR

下記コマンドを実行。

$ phpbrew self-update

概要

MacPHPのバージョン管理をphpbrewでやっていて、PHP7.4を入れようとしたがphpbrew knownで確認した所リストに7.4系がなかった。

$ phpbrew known
Read local release list (last update: 2019-09-29 14:33:51 UTC).
You can run `phpbrew update` or `phpbrew known --update` to get a newer release list.
7.3: 7.3.10, 7.3.9, 7.3.8, 7.3.7, 7.3.6, 7.3.5, 7.3.4, 7.3.3 ...
7.2: 7.2.23, 7.2.22, 7.2.21, 7.2.20, 7.2.19, 7.2.18, 7.2.17, 7.2.16 ...
7.1: 7.1.32, 7.1.31, 7.1.30, 7.1.29, 7.1.28, 7.1.27, 7.1.26, 7.1.25 ...
7.0: 7.0.33, 7.0.32, 7.0.31, 7.0.30, 7.0.29, 7.0.28, 7.0.27, 7.0.26 ...
5.6: 5.6.40, 5.6.39, 5.6.38, 5.6.37, 5.6.36, 5.6.35, 5.6.34, 5.6.33 ...
5.5: 5.5.38, 5.5.37, 5.5.36, 5.5.35, 5.5.34, 5.5.33, 5.5.32, 5.5.31 ...
5.4: 5.4.45, 5.4.44, 5.4.43, 5.4.42, 5.4.41, 5.4.40, 5.4.39, 5.4.38 ...

last updateが明らかに古いので指示通りphpbrew known --updateしたが駄目だった。

$ phpbrew known --update
===> Fetching release list...
Downloading https://secure.php.net/releases/index.php?json&version=7&max=100 via curl extension
[==================================================================] 178.00/178.00B 100%
CurlKit\CurlException:  at [The Location header can not be found: HTTP/2 301
server: myracloud
date: Sat, 12 Sep 2020 22:15:14 GMT
content-type: text/html
content-length: 178
location: https://www.php.net/releases/index.php?json&version=7&max=100
expires: Sat, 12 Sep 2020 22:15:14 GMT
cache-control: max-age=0
etag: "myra-815d4080"]
Trace:

    0) CurlKit\CurlDownloader->request('https://secure.php.net/releases/index.php?json&version=7&max=100')
    1) PhpBrew\Downloader\PhpCurlDownloader->process('https://secure.php.net/releases/index.php?json&version=7&max=100', '/private/var/folders/_r/lc2rsbms73zg4kh8ypstg2l80000gn/T/phpbrew_ZFQfIW')
    2) PhpBrew\Downloader\BaseDownloader->download('https://secure.php.net/releases/index.php?json&version=7&max=100')
    3) PhpBrew\ReleaseList::downloadReleaseListFromOfficialSite(7, GetOptionKit\OptionResult)
    4) PhpBrew\ReleaseList::buildReleaseListFromOfficialSite(GetOptionKit\OptionResult)
    5) PhpBrew\ReleaseList->fetchRemoteReleaseList(GetOptionKit\OptionResult)
    6) PhpBrew\Tasks\FetchReleaseListTask->fetch()
    7) PhpBrew\Command\KnownCommand->execute()
    8) call_user_func_array([PhpBrew\Command\KnownCommand, 'execute'], [])
    9) CLIFramework\CommandBase->executeWrapper([])
    10) CLIFramework\Application->run(['/usr/local/bin/phpbrew', 'known', '--update'])
    11) PhpBrew\Console->runWithTry(['/usr/local/bin/phpbrew', 'known', '--update'])
    12) require('phar:///usr/local/bin/phpbrew/scripts/phpbrew-emb.php')

色々探したが、公式のissueにあったコメントでphpbrew self-updateとあり、解決した。

github.com

$ phpbrew known
Read local release list (last update: 2020-09-12 22:21:19 UTC).
You can run `phpbrew update` or `phpbrew known --update` to get a newer release list.
7.4: 7.4.10, 7.4.9, 7.4.8, 7.4.7, 7.4.6, 7.4.5, 7.4.4, 7.4.3 ...
7.3: 7.3.22, 7.3.21, 7.3.20, 7.3.19, 7.3.18, 7.3.17, 7.3.16, 7.3.15 ...
7.2: 7.2.33, 7.2.32, 7.2.31, 7.2.30, 7.2.29, 7.2.28, 7.2.27, 7.2.26 ...
7.1: 7.1.33, 7.1.32, 7.1.31, 7.1.30, 7.1.29, 7.1.28, 7.1.27, 7.1.26 ...
7.0: 7.0.33, 7.0.32, 7.0.31, 7.0.30, 7.0.29, 7.0.28, 7.0.27, 7.0.26 ...
5.6: 5.6.40, 5.6.39, 5.6.38, 5.6.37, 5.6.36, 5.6.35, 5.6.34, 5.6.33 ...
5.5: 5.5.38, 5.5.37, 5.5.36, 5.5.35, 5.5.34, 5.5.33, 5.5.32, 5.5.31 ...
5.4: 5.4.45, 5.4.44, 5.4.43, 5.4.42, 5.4.41, 5.4.40, 5.4.39, 5.4.38 ...

上記のコメントにある通り、最新バージョンなら発生しないエラーのようなので、エラーになったらとりあえずバージョンアップしよう。