From cf4217b7b4c0db4a8b888bb91a8202deef718366 Mon Sep 17 00:00:00 2001
From: kyrena <78410399+kyrena@users.noreply.github.com>
Date: Fri, 16 Jun 2023 16:59:30 +0200
Subject: [PATCH] Fixed passing null for str_replace is deprecated in
Mage_Downloadable_Block_Adminhtml_Catalog_Product_Edit_Tab_Downloadable_Links
---
.../Product/Edit/Tab/Downloadable/Links.php | 71 ++++++++++---------
1 file changed, 38 insertions(+), 33 deletions(-)
diff --git a/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php b/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php
index 2132ace0449..31de8eb27c8 100644
--- a/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php
+++ b/app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php
@@ -164,41 +164,46 @@ public function getLinkData()
'sample_type' => $item->getSampleType(),
'sort_order' => $item->getSortOrder(),
];
- $file = Mage::helper('downloadable/file')->getFilePath(
- Mage_Downloadable_Model_Link::getBasePath(),
- $item->getLinkFile()
- );
-
- if ($item->getLinkFile() && !is_file($file)) {
- Mage::helper('core/file_storage_database')->saveFileToFilesystem($file);
- }
- if ($item->getLinkFile() && is_file($file)) {
- $name = '' . Mage::helper('downloadable/file')->getFileFromPathFile($item->getLinkFile()) . '';
- $tmpLinkItem['file_save'] = [
- [
- 'file' => $item->getLinkFile(),
- 'name' => $name,
- 'size' => filesize($file),
- 'status' => 'old'
- ]];
+ if ($item->getLinkFile()) {
+ $file = Mage::helper('downloadable/file')->getFilePath(
+ Mage_Downloadable_Model_Link::getBasePath(),
+ $item->getLinkFile()
+ );
+ if (!is_file($file)) {
+ Mage::helper('core/file_storage_database')->saveFileToFilesystem($file);
+ }
+ if (is_file($file)) {
+ $name = '' . Mage::helper('downloadable/file')->getFileFromPathFile($item->getLinkFile()) . '';
+ $tmpLinkItem['file_save'] = [
+ [
+ 'file' => $item->getLinkFile(),
+ 'name' => $name,
+ 'size' => filesize($file),
+ 'status' => 'old'
+ ]
+ ];
+ }
}
- $sampleFile = Mage::helper('downloadable/file')->getFilePath(
- Mage_Downloadable_Model_Link::getBaseSamplePath(),
- $item->getSampleFile()
- );
- if ($item->getSampleFile() && is_file($sampleFile)) {
- $tmpLinkItem['sample_file_save'] = [
- [
- 'file' => $item->getSampleFile(),
- 'name' => Mage::helper('downloadable/file')->getFileFromPathFile($item->getSampleFile()),
- 'size' => filesize($sampleFile),
- 'status' => 'old'
- ]];
+ if ($item->getSampleFile()) {
+ $sampleFile = Mage::helper('downloadable/file')->getFilePath(
+ Mage_Downloadable_Model_Link::getBaseSamplePath(),
+ $item->getSampleFile()
+ );
+ if (is_file($sampleFile)) {
+ $tmpLinkItem['sample_file_save'] = [
+ [
+ 'file' => $item->getSampleFile(),
+ 'name' => Mage::helper('downloadable/file')->getFileFromPathFile($item->getSampleFile()),
+ 'size' => filesize($sampleFile),
+ 'status' => 'old'
+ ]
+ ];
+ }
}
if ($item->getNumberOfDownloads() == '0') {
$tmpLinkItem['is_unlimited'] = ' checked="checked"';