Skip to content

Commit

Permalink
Fixed issue #14227: Some token with existing reponse can send PHP War…
Browse files Browse the repository at this point in the history
…ning about seed

Dev: set a seed if empty
  • Loading branch information
Shnoulle committed Nov 8, 2018
1 parent 7fcbcac commit 665baeb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions application/libraries/MersenneTwister.php
Expand Up @@ -15,6 +15,12 @@ function setSeed($surveyid)
if (isset($_SESSION['survey_'.$surveyid]['srid'])) {
$oResponse = \Response::model($surveyid)->findByPk($_SESSION['survey_'.$surveyid]['srid']);
$seed = $oResponse->seed;
/* fix empty seed, this allow broken seed (not number) */
if(empty($seed)) {
$seed = mt_rand();
$oResponse->seed = $seed;
$oResponse->save();
}
} else {
$seed = mt_rand();

Expand Down

0 comments on commit 665baeb

Please sign in to comment.