diff --git a/src/Faker/Generator.php b/src/Faker/Generator.php index a169997c87..6e54034395 100644 --- a/src/Faker/Generator.php +++ b/src/Faker/Generator.php @@ -184,7 +184,7 @@ public function seed($seed = null) if ($seed === null) { mt_srand(); } else { - mt_srand($seed); + mt_srand((int) $seed); } } diff --git a/test/Faker/GeneratorTest.php b/test/Faker/GeneratorTest.php index 9fea4f867a..e437292abf 100644 --- a/test/Faker/GeneratorTest.php +++ b/test/Faker/GeneratorTest.php @@ -119,6 +119,9 @@ public function testSeed() $this->assertNotEquals($mtRandWithSeedZero, $mtRandWithoutSeed, 'seed() should be different than seed(0)'); $generator->seed(); $this->assertNotEquals($mtRandWithoutSeed, mt_rand(), 'seed() should not be deterministic.'); + + $generator->seed('10'); + $this->assertTrue(true, 'seeding with a non int value doesn\'t throw an exception'); } }