"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:
phpnut 2008-03-22 21:55:44 +00:00
parent 3e61954dbc
commit 92c466c0dc
2 changed files with 12 additions and 2 deletions

View file

@ -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);
}

View file

@ -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')) {