fix: EnvironmentWriterTrait not allowing null values

Fixes https://github.com/pterodactyl/panel/issues/5108

Signed-off-by: Matthew Penner <me@matthewp.io>
This commit is contained in:
Matthew Penner
2025-02-14 13:22:59 -07:00
parent bc07f8e1b1
commit 871ef0c564
@@ -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));
}