Skip to content

Env writer incorrect escaping for ' #56480

@Boy132

Description

@Boy132

Laravel Version

12.21.0

PHP Version

8.3

Database Driver & Version

No response

Description

When using the Env class to update variable values a ' is incorrectly escaped which then breaks the whole site with a HTTP 500 error.

Steps To Reproduce

Use Env::writeVariable to update a variable. The new value should include a ', e.g.:

\Illuminate\Support\Env::writeVariable("APP_NAME", "Boy132's Panel", base_path('.env'), true);

Now the .env file will contain:

APP_NAME="Boy132\'s Panel"

The ' has been escaped with an \ which is incorrect in this case.

Correct would be:

APP_NAME="Boy132's Panel"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions