fix: skip unreadable .env in Boot::loadDotEnv for separate-process tests#10417
fix: skip unreadable .env in Boot::loadDotEnv for separate-process tests#10417gr8man wants to merge 1 commit into
Conversation
michalsn
left a comment
There was a problem hiding this comment.
Now we would silently ignore a present but unreadable .env file. Not acceptable.
If you identified the test that causes this, you may configure the test bootstrap to use a controlled environment directory.
352e956 to
92eac67
Compare
michalsn
left a comment
There was a problem hiding this comment.
Please identify the test or operation that changes the file's permissions and causes the error.
I cannot recreate the issue by running the test command you provided.
PHPUnit 11.5.56 by Sebastian Bergmann and contributors. Runtime: PHP 8.5.8 Time: 00:09.249, Memory: 26.00 MB There was 1 error:
|
|
I found the likely root cause of the test failure — it was in
Fixed in commit 4875736: instead of moving the whole file, the test now only clears the With this fix, no framework changes are needed ( |
92890fc to
9fdc43e
Compare
michalsn
left a comment
There was a problem hiding this comment.
This cannot be the root cause of the reported random-test failure. The Encryption component was not enabled in the random-test configuration used by that run, so EncryptionTest was never executed.
The change may be a reasonable test cleanup, but it does not explain or resolve the cited failure.
Description
Test
ResponseSendTest::testHeaderOverridefails when tests run in random order because the spawned process (#[RunInSeparateProcess]) callsBoot::loadDotEnv()→DotEnv::parse(), which throwsInvalidArgumentExceptionwhen.envexists but is unreadable. The fix adds an earlyis_file()+is_readable()guard soloadDotEnv()returns silently —.envis optional.Tests
No new tests —
DotEnvTest::testLoadsUnreadableFilealready covers the exception path. Verified with: