diff --git a/lib/Cake/Configure/IniReader.php b/lib/Cake/Configure/IniReader.php index debd685c6..f8fe2077f 100644 --- a/lib/Cake/Configure/IniReader.php +++ b/lib/Cake/Configure/IniReader.php @@ -142,6 +142,7 @@ class IniReader implements ConfigReaderInterface { * Dumps the state of Configure data into an ini formatted string. * * @param string $filename The filename on $this->_path to save into. + * Extension ".ini" will be automatically appended if not included in filename. * @param array $data The data to convert to ini file. * @return int Bytes saved. */ @@ -159,6 +160,10 @@ class IniReader implements ConfigReaderInterface { } } $contents = join("\n", $result); + + if (substr($filename, -4) !== '.ini') { + $filename .= '.ini'; + } return file_put_contents($this->_path . $filename, $contents); } diff --git a/lib/Cake/Configure/PhpReader.php b/lib/Cake/Configure/PhpReader.php index f5d961961..32d1f5264 100644 --- a/lib/Cake/Configure/PhpReader.php +++ b/lib/Cake/Configure/PhpReader.php @@ -92,11 +92,16 @@ class PhpReader implements ConfigReaderInterface { * be used saved into a file and loaded later. * * @param string $filename The filename to create on $this->_path. + * Extension ".php" will be automatically appended if not included in filename. * @param array $data Data to dump. * @return int Bytes saved. */ public function dump($filename, $data) { $contents = '_path . $filename, $contents); } diff --git a/lib/Cake/Test/Case/Configure/IniReaderTest.php b/lib/Cake/Test/Case/Configure/IniReaderTest.php index e4b463450..dd1f087b4 100644 --- a/lib/Cake/Test/Case/Configure/IniReaderTest.php +++ b/lib/Cake/Test/Case/Configure/IniReaderTest.php @@ -166,6 +166,13 @@ INI; unlink($file); $this->assertTextEquals($expected, $result); + + $result = $reader->dump('test', $this->testData); + $this->assertTrue($result > 0); + + $contents = file_get_contents($file); + $this->assertTextEquals($expected, $contents); + unlink($file); } /** diff --git a/lib/Cake/Test/Case/Configure/PhpReaderTest.php b/lib/Cake/Test/Case/Configure/PhpReaderTest.php index 08982cb4e..59d4d5178 100644 --- a/lib/Cake/Test/Case/Configure/PhpReaderTest.php +++ b/lib/Cake/Test/Case/Configure/PhpReaderTest.php @@ -151,6 +151,13 @@ PHP; unlink($file); $this->assertTextEquals($expected, $contents); + + $result = $reader->dump('test', $this->testData); + $this->assertTrue($result > 0); + + $contents = file_get_contents($file); + $this->assertTextEquals($expected, $contents); + unlink($file); } /**