mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Update Configure::load() to use Set::merge()
This fixes some of the awkward behavior that using array_merge_recursive() could create. Fixes #2441
This commit is contained in:
parent
1991430584
commit
87924414fc
4 changed files with 12 additions and 3 deletions
|
@ -312,7 +312,7 @@ class Configure {
|
|||
$keys = array_keys($values);
|
||||
foreach ($keys as $key) {
|
||||
if (($c = self::read($key)) && is_array($values[$key]) && is_array($c)) {
|
||||
$values[$key] = array_merge_recursive($c, $values[$key]);
|
||||
$values[$key] = Set::merge($c, $values[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -224,6 +224,8 @@ class ConfigureTest extends CakeTestCase {
|
|||
$this->assertEquals('value2', Configure::read('Read'));
|
||||
$this->assertEquals('buried2', Configure::read('Deep.Second.SecondDeepest'));
|
||||
$this->assertEquals('buried', Configure::read('Deep.Deeper.Deepest'));
|
||||
$this->assertEquals('Overwrite', Configure::read('TestAcl.classname'));
|
||||
$this->assertEquals('one', Configure::read('TestAcl.custom'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,5 +5,8 @@ $config = array(
|
|||
'Deeper' => array(
|
||||
'Deepest' => 'buried'
|
||||
)
|
||||
),
|
||||
'TestAcl' => array(
|
||||
'classname' => 'Original'
|
||||
)
|
||||
);
|
|
@ -5,5 +5,9 @@ $config = array(
|
|||
'Second' => array(
|
||||
'SecondDeepest' => 'buried2'
|
||||
)
|
||||
),
|
||||
'TestAcl' => array(
|
||||
'classname' => 'Overwrite',
|
||||
'custom' => 'one'
|
||||
)
|
||||
);
|
Loading…
Add table
Reference in a new issue