Skip to content

Bug: .env values true/false misinterpreted #4277

Description

@nerdyjan

Environment variables only ever carry strings. Left as-is, an override such as GRAV_CONFIG__system__cache__enabled=false lands in config as the string "false" - and PHP's (bool) cast (used throughout core, e.g. Cache::init()) treats any non-empty, non-"0" string as true, silently doing the opposite of what was asked. Coerce the two boolean literals; every other value (numbers, arbitrary strings) is left untouched, matching prior behavior.

InitializeProcessor.php. Line 235

                if (is_string($value)) {
                    if (strcasecmp($value, 'true') === 0) {
                        $value = true;
                    } elseif (strcasecmp($value, 'false') === 0) {
                        $value = false;
                    }
                }

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions