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

phpdotenv warning about missing .env in theme folder #722

Open
tedw opened this issue May 14, 2024 · 1 comment
Open

phpdotenv warning about missing .env in theme folder #722

tedw opened this issue May 14, 2024 · 1 comment
Labels

Comments

@tedw
Copy link

tedw commented May 14, 2024

Version

1.24.0

What did you expect to happen?

No warnings displayed

What actually happens?

Everything works fine locally but I see the following warning in the WP admin on Pantheon:

file_get_contents(/code/web/wp-content/themes/my_theme/.env): Failed to open stream: No such file or directory

I have an .env file in the app root and have been using Bedrock & Sage for years without issue. I tried changing $dotenv->load(); to $dotenv->safeLoad(); in application.php but it didn’t do anything.

$dotenv->load();

Steps to reproduce

Open the WP admin (I’m using Query Monitor fwiw). The warning goes away if I downgrade to Acorn 3.

System info

PHP 8.2, WP 6.5.3, Sage 10, Acorn 4.2.2, and the following Composer deps:

"php": ">=8.2",
"composer/installers": "^2.2.0",
"ffraenz/private-composer-installer": "^5.0",
"filp/whoops": "^2.14",
"johnbillion/extended-cpts": "^5.0.7",
"log1x/navi": "^3.0.0",
"oscarotero/env": "^2.1",
"pantheon-systems/quicksilver-pushback": "^2.0",
"pantheon-systems/wordpress-composer": "~6.5.2",
"roots/acorn": "^4.2.2",
"roots/acorn-prettify": "^1.0.1",
"roots/bedrock-autoloader": "^1.0",
"roots/bedrock-disallow-indexing": "^2.0",
"roots/wp-config": "1.0.0",
"roots/wp-password-bcrypt": "^1.1.0",
"vlucas/phpdotenv": "^5.4",

Log output

/code/vendor/vlucas/phpdotenv/src/Store/File/Reader.php:73
file_get_contents()
/code/vendor/vlucas/phpdotenv/src/Store/File/Reader.php:73
Dotenv\S\F\Reader::readFromFile()
/code/vendor/vlucas/phpdotenv/src/Store/File/Reader.php:48
Dotenv\S\F\Reader::read()
/code/vendor/vlucas/phpdotenv/src/Store/FileStore.php:62
Dotenv\Store\FileStore->read()
/code/vendor/vlucas/phpdotenv/src/Dotenv.php:222
Dotenv\Dotenv->load()
/code/vendor/vlucas/phpdotenv/src/Dotenv.php:237
Dotenv\Dotenv->safeLoad()
/code/vendor/roots/acorn/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php:29
Illuminate\F\B\LoadEnvironmentVariables->bootstrap()
/code/vendor/roots/acorn/src/Illuminate/Foundation/Application.php:263
Illuminate\Foundation\Application->bootstrapWith()
/code/vendor/roots/acorn/src/Illuminate/Foundation/Http/Kernel.php:186
Illuminate\F\H\Kernel->bootstrap()
/code/vendor/roots/acorn/src/Roots/Acorn/Bootloader.php:187
Roots\Acorn\Bootloader->bootHttp()
/code/vendor/roots/acorn/src/Roots/Acorn/Bootloader.php:103
Roots\Acorn\Bootloader->boot()
wp-content/themes/my_theme/functions.php:43

Please confirm this isn't a support request.

Yes

@tedw tedw added the bug label May 14, 2024
@tedw
Copy link
Author

tedw commented May 14, 2024

I should note that this doesn’t appear to be impacting the site’s functionality but I would really like to get rid of this warning if possible.

Let me know if you think this is more likely an Acorn issue and I will submit there instead. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant