Deprecated: Assigning the return value of new by reference is deprecated in /home/bluestat/public_html/source/index.php on line 477
From 80f45b3429f6e1b2554434c51eebd43b1bcb6626 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 4 Aug 2009 01:06:46 -0400 Subject: [PATCH] Call trimmed_string() in Cleaner::bool() when checking the stringified values. --- input/cleaner.php | 2 +- testing/tests/input/cleaner_test.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/input/cleaner.php b/input/cleaner.php index 4db85ae..761b3cb 100644 --- a/input/cleaner.php +++ b/input/cleaner.php @@ -57,7 +57,7 @@ class Cleaner public static function bool($bool) { - $str = strtolower($bool); + $str = strtolower(self::trimmed_string($bool)); if ($str == 'yes' || $str == 'true') return true; else if ($str == 'no' || $str == 'false') diff --git a/testing/tests/input/cleaner_test.php b/testing/tests/input/cleaner_test.php index 7b01c8b..a2144a7 100644 --- a/testing/tests/input/cleaner_test.php +++ b/testing/tests/input/cleaner_test.php @@ -92,5 +92,7 @@ class CleanerTest extends \PHPUnit_Framework_TestCase $this->assertEquals(false, Cleaner::bool($this->fixture['bool0'])); $this->assertEquals(false, Cleaner::bool($this->fixture['boolF'])); $this->assertEquals(false, Cleaner::bool($this->fixture['boolN'])); + $this->assertEquals(true, Cleaner::bool(' true ')); + $this->assertEquals(false, Cleaner::bool(' no ')); } } -- 1.7.11.3