From 0a0d2dcf2209ee28728e816a7b20856f45e3c99a Mon Sep 17 00:00:00 2001 From: Tomasz Muras Date: Tue, 14 Jul 2020 17:08:44 +0200 Subject: [PATCH] Prevent uninitialized $tmpPath when executing unlink(). --- h5p.classes.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/h5p.classes.php b/h5p.classes.php index a610431..6e5164a 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -752,6 +752,10 @@ class H5PValidator { * TRUE if the .h5p file is valid */ public function isValidPackage($skipContent = FALSE, $upgradeOnly = FALSE) { + // Create a temporary dir to extract package in. + $tmpDir = $this->h5pF->getUploadedH5pFolderPath(); + $tmpPath = $this->h5pF->getUploadedH5pPath(); + // Check dependencies, make sure Zip is present if (!class_exists('ZipArchive')) { $this->h5pF->setErrorMessage($this->h5pF->t('Your PHP version does not support ZipArchive.'), 'zip-archive-unsupported'); @@ -764,10 +768,6 @@ class H5PValidator { return FALSE; } - // Create a temporary dir to extract package in. - $tmpDir = $this->h5pF->getUploadedH5pFolderPath(); - $tmpPath = $this->h5pF->getUploadedH5pPath(); - // Only allow files with the .h5p extension: if (strtolower(substr($tmpPath, -3)) !== 'h5p') { $this->h5pF->setErrorMessage($this->h5pF->t('The file you uploaded is not a valid HTML5 Package (It does not have the .h5p file extension)'), 'missing-h5p-extension');