How to check which files are changed in magento 2 patch?

How to check which files are changed in magento 2 patch?

October 9, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to check which files are changed in magento 2 patch?

Understanding Magento 2 Patches: How to Check Changed Files

As a Magento developer, you’ve likely encountered the need to apply hotfixes and security patches from time to time. While applying these patches is straightforward, it’s crucial to understand what exactly has been changed within your codebase. This post will guide you through the process of checking files that are modified during a Magento 2 patch application.

Why Check Changed Files?

Before diving into the technical aspects, let me briefly explain why this step is essential:

  1. Code Integrity: Patches often modify existing core files and may introduce conflicts with customizations or other patches you have applied.
  2. Security Awareness: Understanding the changes allows you to verify that the patch has fixed the intended issue.
  3. Learning Opportunities: Examining Magento’s own code can provide valuable insights into best practices and architectural patterns.

Accessing the Patch File

First, navigate to the directory containing your downloaded patch file. The patch file will usually have a .patch extension or be an archive containing multiple files in case of a complex patch like ACSD-46146.

Using the diff Command

For Linux-based systems, you can use the built-in diff command to compare the original and patched files. Here’s how:

  1. Extract the patch file if it’s an archive (e.g., tar -xzf acsd-46146_v1.1.18_composer_patch.patch).

  2. Apply the patch using the following command:

    patch -p0 < acsd-46146_v1.1.18_composer_patch.patch
    
  3. Compare the original and patched files:

    diff -u app/code/Magento/Framework/Mail/Model/TransportBuilder.php app/code/Magento/Framework/Mail/Model/TransportBuilder.php.patched
    

In this command, diff compares two versions of a file: the original (app/code/Magento/Framework/Mail/Model/TransportBuilder.php) and the patched version (created by the patch application).

Analyzing the Output

The output will display lines that have been added, removed, or modified in the patched file. The format is as follows:

--- app/code/Magento/Framework/Mail/Model/TransportBuilder.php 2018-09-17 13:46:05.000000000 +0000
+++ app/code/Magento/Framework/Mail/Model/TransportBuilder.php.patched 2018-09-17 13:46:05.000000000 +0000

Lines prefixed with - are deleted, and lines with + are added.

Exploring the Changed Code

Let’s look at a simplified example of what you might find:

-        $transport = new \Zend_Mail_Transport_Smtp($smtpConfig);
+        $transport = new \Magento\Framework\Mail\TransportBuilder();

In this case, the patch replaces the original Zend_Mail_Transport_Smtp object instantiation with a new Magento transport builder.

Verifying Changes in Your Environment

Remember that patches often require additional steps like clearing cache and reindexing. Always follow the specific instructions provided by Adobe for each patch.

Conclusion

Checking changed files is an essential practice when applying Magento 2 patches. By understanding what has been modified, you can better maintain your codebase’s integrity and security.

Don’t forget to always backup your site before applying any patches and thoroughly test afterwards. If you face any challenges or need further guidance on managing your Magento store, feel free to reach out to the experts at Laravel Company.

Magento 2 Security Extensions Admin

Our network