On my Windows when I pull/clone this project from git and run this command
bin/console doctrine:fixtures:load
Careful, database will be purged. Do you want to continue y/N ?y
purging database > loading AppBundle\DataFixtures\ORM\RequestFixture\RequestFixture
[Symfony\Component\Debug\Exception\ContextErrorException] Notice: Undefined offset: -5
It gives me an error.
But when I do it in my Mac, everything runs fine.
I am having this same problem on Windows using XAMPP, PHP 7.2.0, and Symfony 4. The error that I had pointed me to
vendor\fzaninotto\faker\src\Faker\Provider\Base.php. InsideBase::randomElementsthere is the following statement:It looks like
$numis then used to select a random item from the array of fake data that is passed in toBase::randomElementsand then add it to the array of returned$elements.The call to
mt_randis, in your case, returning-5. The offset-5is not defined on the array which is expecting a positive number as the offset.What I was able to figure out is that
mt_rand(0, $highKey)is actually returning a number between-$highKey/2and+$highKey/2. Furthermore, every time the method is invoked it always generates the exact same numbers.I haven't been able to figure our why
mt_rand(0, $highKey)produces a negative number. It could be that the generator is improperly seeded, or it could be a bug in the implementation ofmt_rand, but those just wild guesses at this point.