Fix string '0' not being exported correctly.

Fixes #3518
This commit is contained in:
mark_story 2013-01-09 23:04:58 -05:00
parent 735517ade1
commit 7008b812be
2 changed files with 27 additions and 1 deletions

View file

@ -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 = <<<TEXT
array(
'nothing' => '',
'null' => null,
'false' => false,
'szero' => '0',
'zero' => (int) 0
)
TEXT;
$this->assertTextEquals($expected, $result);
}
/**
* testLog method
*

View file

@ -489,7 +489,7 @@ class Debugger {
case 'float':
return '(float) ' . $var;
case 'string':
if (!trim($var)) {
if (trim($var) === '') {
return "''";
}
return "'" . $var . "'";