Skip to content

Skip undefined environment variable values to prevent runtime exceptions#51

Open
rickkuilman wants to merge 3 commits into
worksome:mainfrom
rickkuilman:bugfix/filter-undefined-values
Open

Skip undefined environment variable values to prevent runtime exceptions#51
rickkuilman wants to merge 3 commits into
worksome:mainfrom
rickkuilman:bugfix/filter-undefined-values

Conversation

@rickkuilman
Copy link
Copy Markdown

@rickkuilman rickkuilman commented Jun 5, 2025

Summary

This PR fixes a bug where environment variables without a value (e.g. SENTRY_LARAVEL_DSN without an = sign) would cause a RuntimeException when parsed, see: #22

What was changed

Updated the ReadEnvironmentFile action to safely skip undefined environment variable values.

Added tests to ensure:

  • Variables without a value are ignored.
  • No exception is thrown when such variables are encountered.
  • Other valid variables are still parsed correctly.

How to test

.env.with-undefined-value file was used containing a key without a value:

APP_NAME=Laravel
ENV_VARIABLE_WITHOUT_VALUE

The test suite confirms that the parser handles this situation correctly.

Updates the ReadEnvironmentFile action to skip environment variables
that have no value (e.g. `SENTRY_LARAVEL_DSN`) instead of throwing a
RuntimeException. Also adds tests to verify that these variables are
ignored and handled gracefully.
@rickkuilman rickkuilman changed the title Bugfix/filter undefined values Skip undefined environment variable values to prevent runtime exceptions Jun 5, 2025
@rickkuilman
Copy link
Copy Markdown
Author

The actual implementation is found in this commit: b388ced

The rest of the file changes are code styling, since that was included in the package :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant