euromark 12 years ago
parent
commit
9cb5ccdc8b
2 changed files with 3 additions and 2 deletions
  1. 2 1
      Lib/Utility/Utility.php
  2. 1 1
      Test/Case/Lib/Utility/UtilityTest.php

+ 2 - 1
Lib/Utility/Utility.php

@@ -51,12 +51,13 @@ class Utility {
 			return $tokens;
 		}
 
+		$tokens = array_map('trim', $tokens);
 		foreach ($tokens as $key => $token) {
 			if ($token === '') {
 				unset($tokens[$key]);
 			}
 		}
-		return array_map('trim', $tokens);
+		return $tokens;
 	}
 
 	/**

+ 1 - 1
Test/Case/Lib/Utility/UtilityTest.php

@@ -46,7 +46,7 @@ class UtilityTest extends MyCakeTestCase {
 		$res = Utility::tokenize('some, thing');
 		$this->assertSame(array('some', 'thing'), $res);
 
-		$res = Utility::tokenize(',some,,,,,thing,');
+		$res = Utility::tokenize(',some,,, ,, thing,');
 		$this->assertSame(array('some', 'thing'), array_values($res));
 	}