diff --git a/lib/Cake/Test/Case/Utility/DebuggerTest.php b/lib/Cake/Test/Case/Utility/DebuggerTest.php index c496c2c7e..f32e5a69c 100644 --- a/lib/Cake/Test/Case/Utility/DebuggerTest.php +++ b/lib/Cake/Test/Case/Utility/DebuggerTest.php @@ -408,6 +408,32 @@ TEXT; $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 09f967983..73ebbfe8a 100644 --- a/lib/Cake/Utility/Debugger.php +++ b/lib/Cake/Utility/Debugger.php @@ -489,7 +489,7 @@ class Debugger { case 'float': return '(float) ' . $var; case 'string': - if (!trim($var)) { + if (trim($var) === '') { return "''"; } return "'" . $var . "'";