Creating a patch file

Patches are sets of changes to the source code that aim to resolve a bug or introduce a new feature.

From a technical point of view the differences introduced by a patch are best represented in "diff" format. This file format contains just the differences between two files. Diffs are widely used for development because they allow easy reviewing of changes to the program code. During the TYPO3 extension security incident handling we use the so-called "unified diff" (a diff variant that contains three lines of context before and after that part that was changed).

If you're working just on some copy of an extension's source code, you may generate a diff using the "diff" command-line utility. Example:

diff -ru typo3conf/ext/your_ext/ typo3conf/ext/your_ext.new/ > bug_1234.diff

How to apply a patch

Patch your source code using a diff file:

cd htdocs/
patch --dry-run -p1 < bug_1234.diff

(Use the --dry-run parameter to first check if the patch applies successfully. Run the same command again without this parameter to make the changes effective).

Have a look at Wikipedia for more information about "diff" and "patch".