Browse Source

Fix debug output on only white spaced strings

Michael Hoffmann 9 years ago
parent
commit
e257dfb012
2 changed files with 3 additions and 1 deletions
  1. 1 1
      src/Error/Debugger.php
  2. 2 0
      tests/TestCase/Error/DebuggerTest.php

+ 1 - 1
src/Error/Debugger.php

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

+ 2 - 0
tests/TestCase/Error/DebuggerTest.php

@@ -280,6 +280,7 @@ class DebuggerTest extends TestCase
         $View = $Controller->createView();
         $View->int = 2;
         $View->float = 1.333;
+        $View->string = '  ';
 
         $result = Debugger::exportVar($View);
         $expected = <<<TEXT
@@ -310,6 +311,7 @@ object(Cake\View\View) {
 	Form => object(Cake\View\Helper\FormHelper) {}
 	int => (int) 2
 	float => (float) 1.333
+	string => '  '
 	[protected] _helpers => object(Cake\View\HelperRegistry) {}
 	[protected] _ext => '.ctp'
 	[protected] _passedVars => [