Index: tests/t3lib/t3lib_divTest.php =================================================================== --- tests/t3lib/t3lib_divTest.php (revision 8748) +++ tests/t3lib/t3lib_divTest.php (working copy) @@ -111,15 +111,13 @@ * * @return array Data sets */ - public function testIntValidDataProvider() { + public function functionTestIntValidDataProvider() { return array( 'int' => array(32425), 'negative int' => array(-32425), 'largest int' => array(PHP_INT_MAX), 'int as string' => array('32425'), - 'int as string with leading zero' => array('01234'), 'negative int as string' => array('-32425'), - 'negative int as string with leading zero' => array('-01234'), 'zero' => array(0), 'zero as string' => array('0'), ); @@ -127,7 +125,7 @@ /** * @test - * @dataProvider testIntValidDataProvider + * @dataProvider functionTestIntValidDataProvider */ public function testIntReturnsTrue($int) { $this->assertTrue(t3lib_div::testInt($int)); @@ -138,14 +136,23 @@ * * @return array Data sets */ - public function testIntInvalidDataProvider() { + public function functionTestIntInvalidDataProvider() { return array( + 'int as string with leading zero' => array('01234'), + 'positive int as string with plus modifier' => array('+1234'), + 'negative int as string with leading zero' => array('-01234'), 'largest int plus one' => array(PHP_INT_MAX + 1), 'string' => array('testInt'), 'empty string' => array(''), 'int in string' => array('5 times of testInt'), + 'int as string with space after' => array('5 '), + 'int as string with space before' => array(' 5'), + 'int as string with many spaces before' => array(' 5'), 'float' => array(3.14159), 'float as string' => array('3.14159'), + 'float as string only a dot' => array('10.'), + 'float as string trailing zero would evaluate to int 10' => array('10.0'), + 'float as string trailing zeros would evaluate to int 10' => array('10.00'), 'null' => array(NULL), 'empty array' => array(array()), 'int in array' => array(array(32425)), @@ -155,7 +162,7 @@ /** * @test - * @dataProvider testIntInvalidDataProvider + * @dataProvider functionTestIntInvalidDataProvider */ public function testIntReturnsFalse($int) { $this->assertFalse(t3lib_div::testInt($int)); Index: t3lib/class.t3lib_div.php =================================================================== --- t3lib/class.t3lib_div.php (revision 8748) +++ t3lib/class.t3lib_div.php (working copy) @@ -1279,7 +1279,10 @@ * @return boolean Returns true if string is an integer */ public static function testInt($var) { - return (string)intval($var) == $var; + if ($var === '') { + return FALSE; + } + return (string)intval($var) === (string)$var; } /**