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

Fix read non existing config file #1398

Merged
merged 1 commit into from
Apr 26, 2023
Merged

Fix read non existing config file #1398

merged 1 commit into from
Apr 26, 2023

Conversation

mischabraam
Copy link
Contributor

@mischabraam mischabraam commented Apr 4, 2023

When composer installing valet, the config.json does not exist yet. If we do a status check like valet status, the non existing config file is read. Which throws an error/warning.

.. % ./valet status
Checking status...
PHP Warning:  file_get_contents(/Users/someone/.config/valet/config.json): Failed to open stream: No such file or directory in /Users/someone/Development/Tools/valet/cli/Valet/Filesystem.php on line 84

Warning: file_get_contents(/Users/someone/.config/valet/config.json): Failed to open stream: No such file or directory in /Users/someone/Development/Tools/valet/cli/Valet/Filesystem.php on line 84

Valet status: Error

+------------------------------------------+----------+
| Check                                    | Success? |
+------------------------------------------+----------+
| Is Valet fully installed?                | No       |
| Is Valet config valid?                   | No       |
| Is Homebrew installed?                   | Yes      |
| Is DnsMasq installed?                    | Yes      |
| Is Dnsmasq running?                      | Yes      |
| Is Dnsmasq running as root?              | Yes      |
| Is Nginx installed?                      | Yes      |
| Is Nginx running?                        | Yes      |
| Is Nginx running as root?                | Yes      |
| Is PHP installed?                        | Yes      |
| Is linked PHP ([email protected]) running?         | Yes      |
| Is linked PHP ([email protected]) running as root? | Yes      |
| Is valet.sock present?                   | No       |
+------------------------------------------+----------+

Debug suggestions:
Run `composer require laravel/valet` and `valet install`.
Run `valet install` to update your configuration.
Run `valet install`.

To fix this we can first check the file of its existence before reading it.

@mattstauffer mattstauffer merged commit dae5773 into laravel:master Apr 26, 2023
@mischabraam mischabraam deleted the hotfix/read-non-existing-config-file branch April 28, 2023 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants