mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
"Fixes #4336, Setting a Configure key to null causes php warning."
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6598 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
3e61954dbc
commit
92c466c0dc
2 changed files with 12 additions and 2 deletions
|
@ -247,7 +247,7 @@ class Configure extends Object {
|
|||
function write($config, $value = null) {
|
||||
$_this =& Configure::getInstance();
|
||||
|
||||
if (!is_array($config) && $value !== null) {
|
||||
if (!is_array($config)) {
|
||||
$config = array($config => $value);
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ class ConfigureTest extends UnitTestCase {
|
|||
$result = $this->Configure->listObjects('helper');
|
||||
$this->assertTrue(in_array('Html', $result));
|
||||
}
|
||||
|
||||
|
||||
function testRead() {
|
||||
$expected = 'ok';
|
||||
|
||||
|
@ -82,6 +82,16 @@ class ConfigureTest extends UnitTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
function testWriteConfig() {
|
||||
$this->Configure->write('SomeName.someKey', 'myvalue');
|
||||
$result = $this->Configure->read('SomeName.someKey');
|
||||
$this->assertEqual($result, 'myvalue');
|
||||
|
||||
$this->Configure->write('SomeName.someKey', null);
|
||||
$result = $this->Configure->read('SomeName.someKey');
|
||||
$this->assertEqual($result, null);
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
unset($this->Configure);
|
||||
if (file_exists(TMP . 'cache' . DS . 'persistent' . DS . 'cake_core_core_paths')) {
|
||||
|
|
Loading…
Reference in a new issue