-
-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix environment loader #4617
base: main
Are you sure you want to change the base?
Fix environment loader #4617
Conversation
@sreichel Please see this PR. |
Quick test. 404 one every page. |
Maybe it come from invalid setting .... ?
|
For reference my old config:
With yours I am getting infinite loop. |
The error was caused by the via 1f6b7ed |
Thanks for working on it. Cant make a PR to your repo right now ... how about to filter env vars in getEnv()? public function getEnv(): array
{
if (is_null($this->envStore)) {
$env = getenv();
$env = array_filter($env, function ($key) {
return str_starts_with($key, self::ENV_STARTS_WITH);
}, ARRAY_FILTER_USE_KEY);
$this->envStore = $env;
}
return $this->envStore;
} Maybe add an additional check for env |
Yes, on default scope, but not on one website/storeview level. (Scope label should ben changed to "ENV") |
Note ... Tests should be updated. |
1f6b7ed
to
9072ff8
Compare
In "Default" scope the attribute is locked. For "German" storeview its not.
No, not that other "label". :) "[STORE VIEW]" could change to "[ENV]" and the checkbox can be removed. I am busy for the next 2-3 days. I'll test ASAP. |
Hm. For me its locked.
Gotcha. Good point. |
Not sure about it, sorry. Maybe the disabled checkbox was missleading. (?) |
Great! ❤️ I can make a PR later, but if you have time for it, please check the red SonarCloud issues. |
I've removed one case. I'm not sure how else to get there (without makeing the cache array public?) |
To pass the complexity-check it should be enough to move try/catch-parts to a seperate method. Leave it as it is, i'll add a PR later. PS: please |
:/ |
Co-authored-by: Sven Reichel <[email protected]>
Co-authored-by: Sven Reichel <[email protected]>
Co-authored-by: Sven Reichel <[email protected]>
Co-authored-by: Sven Reichel <[email protected]>
Co-authored-by: Sven Reichel <[email protected]>
Co-authored-by: Sven Reichel <[email protected]>
08756c9
to
1d31f4a
Compare
Co-authored-by: Sven Reichel <[email protected]>
A standalone file that i use for simple debugging ... <?php
declare(strict_types=0);
require_once('app/Mage.php');
umask(0);
Mage::app();
echo '<pre>';
# ....
function test4617()
{
var_dump(Mage::getStoreConfig('general/store_information/name'));
}
$test = $_GET['test'];
if (is_string($test) && function_exists($test)) {
$test();
} |
Hm somethings not right on your end. Even with your test script I am getting the env variable. 🤷 |
Working on php81 branch right now ... can you please test ith with that config (#4617 (comment))? Also faced some issues (need to verify that) in admin config sections - like missing dropdowns. (Possibly from another change i made?) |
That is the config I am using right now. |
Only an idea ... is config cache possibly disabled? |
All my caches are |
Okay okay :D I'll test it later. |
|
Seems you could reproduce my issue 👍 |
Not with the |
I found it not working and I need to work on it some more. |
|
Description (*)
This PR attempts to fix the incomplete attempt for config values to be overwritten from ENV variables.
Related Pull Requests
Fixed Issues (if relevant)
Relates to issue #4257 (comment)
Manual testing scenarios (*)
Mage::getStoreConfig
.Automated tests:
ddev phpunit --group Mage_Core_EnvLoader
Questions or comments
Please give feedback to this WIP solution.
Maybe in the future we can add a reasoning of "why" the field in the backend is disabled for edits. Such as give a "warning" sign and show that this field is overwritten by a environment variable.
I feel that this is out of scope for now, for I think that the feature should first work the best it can.
Contribution checklist (*)