Magento 1.7.2 SECURITY PATCH ERROR Via SSH

房东的猫 提交于 2019-12-01 04:24:09

Try to create new text file, for example, mypatch.patch and copy diffs from patch to it

diff --git app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php
index 9e8d6be..b106d09 100644
--- app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php
+++ app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php
@@ -197,11 +197,11 @@ class Mage_Cms_Helper_Wysiwyg_Images extends Mage_Core_Helper_Abstract
     public function getCurrentPath()
     {
         if (!$this->_currentPath) {
-            $currentPath = $this->getStorageRoot();
-            $path = $this->_getRequest()->getParam($this->getTreeNodeName());
-            if ($path) {
-                $path = $this->convertIdToPath($path);
-                if (is_dir($path)) {
+            $currentPath = realpath($this->getStorageRoot());
+            $node = $this->_getRequest()->getParam($this->getTreeNodeName());
+            if ($node) {
+                $path = realpath($this->convertIdToPath($node));
+                if (is_dir($path) && false !== stripos($path, $currentPath)) {
                     $currentPath = $path;
                 }
             }

Then copy it into root of your store and do:

patch -p0 < mypatch.patch

OR may be try to change

_check_installed_tools() {

to

function _check_installed_tools {

in base script

I ran into the same error:

root@www01:/www/sites/REDACTED/files/html# sh PATCH_SUPEE-2518_EE_1.10.1.0-1.13.0.2_v1.sh
: not found-2518_EE_1.10.1.0-1.13.0.2_v1.sh: 7:
: not found-2518_EE_1.10.1.0-1.13.0.2_v1.sh: 11:
PATCH_SUPEE-2518_EE_1.10.1.0-1.13.0.2_v1.sh: 168: Syntax error: "(" unexpected (expecting "then")

When I checked it out in vim, I saw that it was encoded in DOS. Ran dos2unix on it and the patch installed successfully:

root@www01:/www/sites/REDACTED/files/html# dos2unix PATCH_SUPEE-2518_EE_1.10.1.0-1.13.0.2_v1.sh
dos2unix: converting file PATCH_SUPEE-2518_EE_1.10.1.0-1.13.0.2_v1.sh to UNIX format ...
root@www01:/www/sites/REDACTED/files/html# bash PATCH_SUPEE-2518_EE_1.10.1.0-1.13.0.2_v1.sh
Checking if patch can be applied/reverted successfully...
Patch was applied/reverted successfully.

I encountered this same error. I fixed it by installing "Patch". Strangely enough I came to this thread for answers and tried them all except for @hadis suggestion. I misinterpreted his solution by trying to run "yum patch_name.sh"

I eventually looked at the file and after that his solution was fairly obvious. Once "Patch" is installed, execute the script again and voila! :)

yum install patch

sh PATCH_SUPEE-1868_CE_1.7.0.2_v1.sh

you must install patch try this: yum install patch

Daniel Flippance

I found that this error occurs when the patch file (not the file being patched) has line endings which do not match the system on which it is being run.

eg:

  • You are running on Linux
  • The patch file has Windows line endings

Then you need to check that the file being patched also has line endings for the system on which it's being run

See also Error patching Magento 1.7.1 Hunk #1 Failed at

Go to magento download patch site. When you click on the download button on magento site then it will open a new site with the patch-code. make a right click on it and choose view source code (with chrome)

view-source:http://www.magentocommerce.com/index.php/getmagento/ce_patches/PATCH_SUPEE-2629_EE_1.12.0.0_v1.sh

then make a right click once again and save the file as e.g. PATCH_SUPEE-2629_EE_1.12.0.0_v1.sh. Finally move the file to the root directory of your magento install and try to apply the patch once again. For me it works.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!