Skip to content

Commit

Permalink
fix: EnvironmentWriterTrait not allowing null values
Browse files Browse the repository at this point in the history
Fixes #5108

Signed-off-by: Matthew Penner <me@matthewp.io>
  • Loading branch information
matthewpi committed Feb 14, 2025
1 parent bc07f8e commit 871ef0c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/Traits/Commands/EnvironmentWriterTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ trait EnvironmentWriterTrait
* reasonably cause environment parsing issues. Those values are then wrapped
* in quotes before being returned.
*/
public function escapeEnvironmentValue(string $value): string
public function escapeEnvironmentValue(?string $value): string
{
if (is_null($value)) {
return '';
}

if (!preg_match('/^\"(.*)\"$/', $value) && preg_match('/([^\w.\-+\/])+/', $value)) {
return sprintf('"%s"', addslashes($value));
}
Expand Down

0 comments on commit 871ef0c

Please sign in to comment.