2

I am running Magento version 1.9.2.0 and I am trying to install patch 7405 v1.1 with "PATCH_SUPEE-7405_CE_1.9.2.0_v1.1-2016-02-23-07-41-47.sh" but I am getting an error patching. Below is the error I am getting

sh PATCH_SUPEE-7405_CE_1.9.2.0_v1.1-2016-02-23-07-41-47.sh

Checking if patch can be applied/reverted successfully...

ERROR: Patch can't be applied/reverted successfully.

patching file app/code/core/Mage/Adminhtml/Helper/Sales.php

Hunk #1 FAILED at 121. 1 out of 1 hunk Failed -- saving rejects to file app/code/core/Mage/Adminhtml/Helper/Sales.php.rej

patching file app/code/core/Mage/Core/Model/Config.php patching file

app/code/core/Mage/Sales/Model/Quote/Item.php

patching file lib/Varien/File/Uploader.php

The previous version(7405 v1) was installed by my developer who said he never change the core file manually which I think is a lie because I checked the core file and noticed $links = array(); was added :

if (!empty($data) && is_array($allowedTags) && in_array('a', $allowedTags)) {
 #$links = [];
 $links = array();
 $i = 1;
 $data = str_replace('%', '%%', $data);
 $regexp = "/<a\s[^>]*href\s*?=\s*?([\"\']??)([^\" >]*?)\\1[^>]*>(.*)<\/a>/siU";
 while (preg_match($regexp, $data, $matches)) {
 //Revert the sprintf escaping
 $url = str_replace('%%', '%', $matches[2]);
 $text = str_replace('%%', '%', $matches[3]);
 //Check for an valid url
 if ($url) {
 $urlScheme = strtolower(parse_url($url, PHP_URL_SCHEME));
 if ($urlScheme !== 'http' && $urlScheme !== 'https') {
 $url = null;
 }
 }
 //Use hash tag as fallback
 if (!$url) {
 $url = '#';
 }
 //Recreate a minimalistic secure a tag
 $links[] = sprintf(
 '<a href="%s">%s</a>',
 htmlspecialchars($url, ENT_QUOTES, 'UTF-8', false),
 parent::escapeHtml($text)
 );
 $data = str_replace($matches[0], '%' . $i . '$s', $data);
 ++$i;
 }
 $data = parent::escapeHtml($data, $allowedTags);
 return vsprintf($data, $links);
 }
 return parent::escapeHtml($data, $allowedTags);
 }
} 

I have delete $links = array(); and remove # in front of the (#$links = [];) but still given the same error.

I checked app/etc/ folder for "applied.patches.list" but there is no file with that name, I noticed there is "PATCH_SUPEE-7405_CE_1.9.2.2_v1-2016-01-20-04-35-33.sh" in my Magento folder which I believe is the file he used to patch. My question is can you use a patch with version 1.9.2.2 on Magento version 1.9.2.0? Do I need to download "PATCH_SUPEE-7405_CE_1.9.2.2_v1.1-2016-02-23-07-41-47.sh" instead of "PATCH_SUPEE-7405_CE_1.9.2.0_v1.1-2016-02-23-07-41-47.sh" to solve the problem?

Any help please?

1 Answer 1

2

Sometime even after you delete the line of code some spaces or other things still present, which is when magento checks for it's originality, it fails and then doesn't applies the patch.

I would recommend you to download fresh file app/code/core/Mage/Adminhtml/Helper/Sales.php and replace it then apply the patch.

That should fix the trouble.

UPDATE

To download older/your version of magento:

Step 1: Go to below link

http://www.magentocommerce.com/download

And then click on Release Archives tab and here you will find old magento version

Step 2: You can login to magento and then go to download section, you will see available option for you. (This is for Enterprise users)

7
  • Thank you for your reply but how do I download fresh app/code/core/Mage/Adminhtml/Helper/Sales.php file? and do I patch with the version 1.9.2.0 or download one for version 1.9.2.2 since I believe my developer patched with PATCH_SUPEE-7405_CE_1.9.2.2_v1-2016-01-20-04-35-33.sh
    – Tank
    Commented Mar 10, 2016 at 0:09
  • magentocommerce.com/download for magento fresh file, you should install the patch that applicable to your version, if it is not applicable, then obviously magento won't allow you to install. Commented Mar 10, 2016 at 0:11
  • Ok I will download fresh Magento file then replace my app/code/core/Mage/Adminhtml/Helper/Sales.php file. The question I have is, since this is a fresh file from 2015 it will not have any patch applied to it so do I have to reapply SUPEE 7405 v1 then 7405 v1.1 or just apply the SUPEE 7405 v1.1 then it will be ok.
    – Tank
    Commented Mar 10, 2016 at 1:37
  • Check my updated answer. Commented Mar 10, 2016 at 1:40
  • Thank you, I have just downloaded it (version 1.9.2.0). You know it only has up to SUPEE-6285 integrated in it so the file app/code/core/Mage/Adminhtml/Helper/Sales.php will not have 7405 v1 patched to it. Sorry what I mean is do I replace the sales.php then just patch with the 7405v1.1? Thank you
    – Tank
    Commented Mar 10, 2016 at 2:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.