Skip to content

Context is reset when another setting is get from default parameter #88

@CharlieEtienne

Description

@CharlieEtienne

Laravel Settings

v3.4.1

Laravel Version

v12.24.0

Bug description

When we get a setting passing another get in default parameter, the context of the first one is reset:

Settings::context(new Context([]))
    ->get(
        'page_title', 
        Settings::context(new Context([]))->get('app_name', 'My App')
    );

Because of this piece of code in the get method (I think):

if ($this->resetContext) {
    $this->context();
}

$this->temporarilyDisableCache = false;
$this->resetContext = true;

The page_title key is generated without context.

For example when using ReadableKeyGenerator (but that's the same with MD5):

"page-title"

instead of

"page-title:c:::O:31:"Rawilk\Settings\Support\Context":1:{s:12:"\x00*\x00arguments";a:0:{}}"

Steps to reproduce

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions