diff --git a/lib/Cake/Test/Case/Utility/DebuggerTest.php b/lib/Cake/Test/Case/Utility/DebuggerTest.php index c496c2c7eda..f32e5a69cfb 100644 --- a/lib/Cake/Test/Case/Utility/DebuggerTest.php +++ b/lib/Cake/Test/Case/Utility/DebuggerTest.php @@ -408,6 +408,32 @@ public function testExportVar() { $this->assertTextEquals($expected, $result); } +/** + * Test exporting various kinds of false. + * + * @return void + */ + public function testExportVarZero() { + $data = array( + 'nothing' => '', + 'null' => null, + 'false' => false, + 'szero' => '0', + 'zero' => 0 + );; + $result = Debugger::exportVar($data); + $expected = << '', + 'null' => null, + 'false' => false, + 'szero' => '0', + 'zero' => (int) 0 +) +TEXT; + $this->assertTextEquals($expected, $result); + } + /** * testLog method * diff --git a/lib/Cake/Utility/Debugger.php b/lib/Cake/Utility/Debugger.php index 09f967983eb..73ebbfe8a29 100644 --- a/lib/Cake/Utility/Debugger.php +++ b/lib/Cake/Utility/Debugger.php @@ -489,7 +489,7 @@ protected static function _export($var, $depth, $indent) { case 'float': return '(float) ' . $var; case 'string': - if (!trim($var)) { + if (trim($var) === '') { return "''"; } return "'" . $var . "'";