Skip to content

Missing .env file triggers an error with wp-env #3265

@markonikolas

Description

@markonikolas

Version

11.0.1

What did you expect to happen?

Not triggering an error when .env is missing from the sage folder.

What actually happens?

An error is triggered due to missing .env file.
It doesn't show output straight away, but it shows margin in the left sidebar which shouldn't be there. Upon further inspection it seems that the code throws a silent error.

Image
Image

file_get_contents(/var/www/html/wp-content/themes/<your-theme-name>/.env): Failed to open stream: No such file or directory"

Steps to reproduce

Install the theme with composer

composer create-project roots/sage=11.0.1 your-theme-name

Add minimal .wp-env.json config

{
  "core": "WordPress/WordPress#6.8",
  "phpVersion": "8.3",
  "themes": ["."]
}

Get the last error

// functions.php
header("Content-Type: application/json");
die(var_dump(error_get_last()));

System info

No response

Log output

Please confirm this isn't a support request.

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions