0
patching file app/Mage.php
Hunk #1 FAILED at 813.
1 out of 1 hunk FAILED -- saving rejects to file app/Mage.php.rej

Can anyone point me in the right direction as to why I've a bunch of messages that say Hunk #1 FAILED I run PHP 7.2 with Magento 1.9.3.1 and I'm applying the correct patch.

0

"Hunk failed" error message indicates that your app/Mage.php is modified (especially around line 813) and patch tool cannot find a place to add/remove patching code lines.

It is required to review your app/Mage.php comparing it with original file from 1.9.3.1 distribution to understand nature of this difference.

app/Mage.php file for 1.9.3.1 version was updated in SUPEE-10415, SUPEE-10570v2, SUPEE-11086 patches and it is required to have all these patches installed prior to SUPEE-11155. So as the first step, please make sure you have all these patches installed.

If these changes in app/Mage.php are some custom code approved by you or your developer, you may need to apply the failed hunk manually, you can find it in unified diff format right in the patch file (PATCH_SUPEE-11155_CE_1.9.3.1_v3-2019-06-18-08-15-43.sh):

diff --git app/Mage.php app/Mage.php
index a0aa92a440d..02147d3ad43 100644
--- app/Mage.php
+++ app/Mage.php
@@ -813,9 +813,9 @@ final class Mage
             ',',
             (string) self::getConfig()->getNode('dev/log/allowedFileExtensions', Mage_Core_Model_Store::DEFAULT_CODE)
         );
-        $logValidator = new Zend_Validate_File_Extension($_allowedFileExtensions);
         $logDir = self::getBaseDir('var') . DS . 'log';
-        if (!$logValidator->isValid($logDir . DS . $file)) {
+        $validatedFileExtension = pathinfo($file, PATHINFO_EXTENSION);
+        if (!$validatedFileExtension || !in_array($validatedFileExtension, $_allowedFileExtensions)) {
             return;
         }

Otherwise, you may need to revert app/Mage.php to original version from 1.9.3.1 and re-apply all previous patches to that file (SUPEE-10415, SUPEE-10570v2, SUPEE-11086).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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