Skip to content

Commit

Permalink
PHP8: fixes passing null to `Mage_Downloadable_Helper_File::getFilePa…
Browse files Browse the repository at this point in the history
…th()` (#8)

* Fixes OpenMage/magento-lts#OpenMage#3619

* Renamed test

* Fixed test

* Removed tests here ...
  • Loading branch information
sreichel committed Feb 14, 2024
1 parent 16167e3 commit 38e3480
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/code/core/Mage/Downloadable/Helper/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ protected function _moveFileFromTmp($baseTmpPath, $basePath, $file)
$this->getFilePath($basePath, $destFile)
);

$result = $ioObject->mv(
$ioObject->mv(
$this->getFilePath($baseTmpPath, $file),
$this->getFilePath($basePath, $destFile)
);
Expand All @@ -129,6 +129,10 @@ protected function _moveFileFromTmp($baseTmpPath, $basePath, $file)
*/
public function getFilePath($path, $file)
{
if (is_null($file) || $file === '') {
return $path . DS;
}

$file = $this->_prepareFileForPath($file);

if (substr($file, 0, 1) == DS) {
Expand Down Expand Up @@ -157,11 +161,7 @@ protected function _prepareFileForPath($file)
*/
public function getFileFromPathFile($pathFile)
{
$file = '';

$file = substr($pathFile, strrpos($this->_prepareFileForPath($pathFile), DS) + 1);

return $file;
return substr($pathFile, strrpos($this->_prepareFileForPath($pathFile), DS) + 1);
}

/**
Expand Down

0 comments on commit 38e3480

Please sign in to comment.