Task: #53687 Handle missing mode fallback and add no-mode cfg tests
This commit is contained in:
parent
2737ec1d65
commit
adf5a98768
5 changed files with 45 additions and 3 deletions
|
|
@ -159,7 +159,18 @@ class Settings implements \Iterator, \Countable
|
|||
// if a mode was set in the constructor do not overwrite it
|
||||
if (! isset($this->mode)) {
|
||||
// if a localConf Mode is set use it, or take the default conf mode
|
||||
$this->mode = (isset($localConf['mode'])) ? $localConf['mode'] : $this->settings['mode'];
|
||||
// if local/default config has no mode, fall back to the first known mode (normally "prod")
|
||||
if (isset($localConf['mode']) && is_string($localConf['mode']) && $localConf['mode'] !== '') {
|
||||
$this->mode = $localConf['mode'];
|
||||
}
|
||||
elseif (isset($this->settings['mode']) && is_string($this->settings['mode']) && $this->settings['mode'] !== '') {
|
||||
$this->mode = $this->settings['mode'];
|
||||
}
|
||||
else {
|
||||
// Backward-compatible fallback for configs without explicit mode.
|
||||
$this->mode = (string)array_key_first($this->modes);
|
||||
$this->settings['mode'] = $this->mode;
|
||||
}
|
||||
} else {
|
||||
$this->settings['mode'] = $this->mode;
|
||||
}
|
||||
|
|
@ -358,4 +369,4 @@ class Settings implements \Iterator, \Countable
|
|||
|
||||
/* jEdit buffer local properties {{{
|
||||
* :folding=explicit:collapseFolds=1:
|
||||
}}}*/
|
||||
}}}*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue