From d00b7e56680e00850ee470e833cadc9b68d47418 Mon Sep 17 00:00:00 2001 From: Arkadiusz Kondas Date: Tue, 6 Dec 2016 08:50:18 +0100 Subject: [PATCH] Secure uniqid usage --- src/Phpml/SupportVectorMachine/SupportVectorMachine.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Phpml/SupportVectorMachine/SupportVectorMachine.php b/src/Phpml/SupportVectorMachine/SupportVectorMachine.php index 2bef22f..cf5ce3b 100644 --- a/src/Phpml/SupportVectorMachine/SupportVectorMachine.php +++ b/src/Phpml/SupportVectorMachine/SupportVectorMachine.php @@ -132,7 +132,7 @@ class SupportVectorMachine { $this->labels = $labels; $trainingSet = DataTransformer::trainingSet($samples, $labels, in_array($this->type, [Type::EPSILON_SVR, Type::NU_SVR])); - file_put_contents($trainingSetFileName = $this->varPath.uniqid(), $trainingSet); + file_put_contents($trainingSetFileName = $this->varPath.uniqid('phpml', true), $trainingSet); $modelFileName = $trainingSetFileName.'-model'; $command = $this->buildTrainCommand($trainingSetFileName, $modelFileName); @@ -161,7 +161,7 @@ class SupportVectorMachine public function predict(array $samples) { $testSet = DataTransformer::testSet($samples); - file_put_contents($testSetFileName = $this->varPath.uniqid(), $testSet); + file_put_contents($testSetFileName = $this->varPath.uniqid('phpml', true), $testSet); file_put_contents($modelFileName = $testSetFileName.'-model', $this->model); $outputFileName = $testSetFileName.'-output';