Applies a patch from a local or remote file to any package that is part of a given composer project.

Overview

Vaimo Composer Patches

Latest Stable Version Build Status Total Downloads Daily Downloads Minimum PHP Version Scrutinizer Code Quality Code Climate

Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level in package config or separate JSON file. Declaration-free mode (using embedded info within patch files) is available as well.

The way the patches are applied (the commands, pre-checks) by the plugin is fully configurable (including the actual commands that are executed to apply the patch) from the composer.json of the project.

Note that the plugin is kept on very old PHP version as legacy software is usually the most common context where patches are needed.

Full Documentation

  • Basic Usage - Defining patches via configuration files or embedded metadata
  • Advanced Usage - Advanced usage options when defining patches
  • Configuration - Configuration options for the patch applier
  • Commands - Details on the CLI commands that ship with the plugin
  • Environment Variables - Environment variables to change plugin behavior
  • Error Handling - Handling encountered errors
  • Development - Details on the development workflow of the plugin
  • Examples - Examples on usage of the plugin
  • Changes - List of changes/fixes per plugin release

Quick Start

Composer packages can be targeted with patches in two ways:

  • Embedded metadata (recommended default approach)
  • JSON declaration and embedded (recommended for remote patches)

Usage: Embedded Metadata

{
  "require": {
    "some/package-name": "1.2.3"
  },
  "extra": {
    "patcher": {
      "search": "patches"
    }
  }
}

Contents of patches/changes.patch:

This patch changes... 
absolutely everything

@package some/package-name

--- Models/Example.php.org
+++ Models/Example.php
@@ -31,7 +31,7 @@
      */
     protected function someFunction($someArg)
     {
-        $var1 = 123;
+        $var1 = 456; // patched by composer-patches
         /**
          * rest of the logic of the function
          */

As a good practice you might want to add a hint, that the file was patched.

Full list of tag options (that cover all features of the plugin can be found HERE).

Note that tags cover most of the features of the module so every explanation given for the json declaration of the patches applies for tags as well.

Usage: JSON Declaration

{
  "require": {
    "some/package-name": "1.2.3"
  },
  "extra": {
    "patches": {
      "some/package-name": {
        "This patch changes ... absolutely everything": "patches/changes.patch",
        "remote patch": "http://www.example.com/remote-patch.patch",
        "remote patch with checksum check": {
          "source": "http://www.example.com/other-patch.patch",
          "sha1": "5a52eeee822c068ea19f0f56c7518d8a05aef16e"
        }
      }
    }
  }
}

Contents of patches/changes.patch:

--- Models/Example.php.org
+++ Models/Example.php
@@ -31,7 +31,7 @@
      */
     protected function someFunction($someArg)
     {
-        $var1 = 123;
+        $var1 = 456;
         /**
          * rest of the logic of the function
          */

Applier Configuration

The way patches are applied can be manipulated by changing the configuration of the patcher or by introducing additional patch appliers.

In most cases there should not be much of a need to reconfigure the module as it does ship with reasonable defaults. The appliers supported by default: patch, git.

More information on said topic can be found HERE.

Upgrades

When upgrading the module, one might encounter odd crashes about classes not being found or class constructor arguments being wrong.

This usually means that the class structure or constructor footprint in some of the classes have changed after the upgrade which means that the plugin might be running with some classes from the old and some classes from the new version.

Due to the fact that the patcher kicks in very late in the process of installing a project (before auto-loader generation), developers are advised to re-execute composer install.

Ideally, plugins should always be updated with explicit --no-plugins flag added to the composer update call to avoid issues that plugin usage with potentially mixed logic from two different plugin releases being in use.

Comments
  • patches-search not working as documented?

    patches-search not working as documented?

    patches-search seems to not be functional

    Pre-requisites

    1. Using laravel framework (with laravel-enso on top)

    To Reproduce Steps to reproduce the behavior:

    1. create patches_composer folder
    2. create a laravel-compile-unique.patch inside contents:
    pre-support unique indexes on nullable fields
    
    @package laravel/framework
    
    --- src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php.org
    +++ src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php
    @@ -105,10 +105,11 @@
          */
         public function compileUnique(Blueprint $blueprint, Fluent $command)
         {
    -        return sprintf('create unique index %s on %s (%s)',
    +        return sprintf('create unique index %s on %s (%s) where %s is not null',
                 $this->wrap($command->index),
                 $this->wrapTable($blueprint),
    -            $this->columnize($command->columns)
    +            $this->columnize($command->columns),
    +            implode(' is not null and ', $this->wrapArray($command->columns))
             );
         }
    
    1. ensure "patches-search": "patches_composer" is part of the extra key in composer.json

    Expected

    laravel/framework
      ~ my-package: patches_composer/laravel-compile-unique.patch [NEW]
        pre-support unique indexes on nullable fields
    

    Actual A clear and concise description of what actually happened. No patches appearing at all

    Notes (Optional) Add any other context about the problem here. Tested both on my local (windows 10-based) dev machine with PHP 7.1 and on the deployment CentOs server with PHP 7.2.

     composer patch:list --from-source -vvv
    Reading ./composer.json
    Loading config file ./composer.json
    Checked CA file C:\<redacted>.tmp: valid
    Executing command (C:\<redacted>): git branch --no-color --no-abbrev -v
    Reading C:/Users/<redacted>/AppData/Roaming/Composer/composer.json
    Loading config file C:/Users/<redacted>/AppData/Roaming/Composer/composer.json
    Reading C:\Users\<redacted>/vendor/composer/installed.json
    Reading C:/Users/<redacted>/AppData/Roaming/Composer/vendor/composer/installed.json
    Loading plugin PackageVersions\Installer
    Loading plugin Vaimo\ComposerPatches\Plugin
    Running 1.8.0 (2018-12-03 10:31:16) with PHP 7.1.20 on Windows NT / 10.0
    

    and

    $ composer patch:list --from-source -vvv
    Reading ./composer.json
    Loading config file ./composer.json
    Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
    Executing command (/home/gitlab-runner/builds/f67e7d46/1/<redacted>): git branch --no-color --no-abbrev -v
    Executing command (/home/gitlab-runner/builds/f67e7d46/1/<redacted>): git describe --exact-match --tags
    Reading /home/gitlab-runner/.config/composer/composer.json
    Loading config file /home/gitlab-runner/.config/composer/composer.json
    Reading /home/gitlab-runner/builds/f67e7d46/1/<redacted>/vendor/composer/installed.json
    Reading /home/gitlab-runner/.config/composer/vendor/composer/installed.json
    Loading plugin PackageVersions\Installer
    Loading plugin Vaimo\ComposerPatches\Plugin
    Running 1.6.5 (2018-05-04 11:44:59) with PHP 7.2.16 on Linux / 3.10.0-957.5.1.el7.x86_64
    

    Using

            "patches": {
                "laravel/framework": {
                    "pre-support unique indexes on nullable fields": "patches_composer/laravel-compile-unique.patch"
                }
            }
    

    does seem to work as expected.

    I assume I'm doing something wrong, but I can't figure out what.

    bug 
    opened by jlsjonas 21
  • Composer 2 - Package not available during patching

    Composer 2 - Package not available during patching

    A clear and concise description of what the bug is.

    Pre-requisites

    1. Magento 2.3.6 installed via composer
    2. Add compatibility for composer 2 https://gist.github.com/hostep/26de0bf2bb695eb3b6d51858c2e4562e
    3. Install vaimo composer patches using composer require vaimo/composer-patches 4.22.1
    4. Composer version 2.0.9 2021-01-27 16:09:27

    To Reproduce Steps to reproduce the behavior:

    1. Add following lines to composer.json
    ...
                "extra": {
                    "magento-force": "override",
                    "patches": {
                        "tedivm/jshrink": {
                            "Static content deploy - Performance fix for JS/CSS minifier": {
                                "source": "patches/jshrink.diff",
                                "level": 1
                            }
                        },
    ...
    
    
    1. put the following content in the patches/jshrink.diff:
    diff --git a/src/JShrink/Minifier.php b/src/JShrink/Minifier.php
    index ad8157f..fad43d2 100644
    --- a/src/JShrink/Minifier.php
    +++ b/src/JShrink/Minifier.php
    @@ -38,6 +38,13 @@ class Minifier
          */
         protected $input;
     
    +    /**
    +     * Length of input javascript.
    +     *
    +     * @var int
    +     */
    +    protected $len = 0;
    +
         /**
          * The location of the character (in the input string) that is next to be
          * processed.
    @@ -77,7 +84,7 @@ class Minifier
         /**
          * These characters are used to define strings.
          */
    -    protected $stringDelimiters = ['\'', '"', '`'];
    +    protected $stringDelimiters = ['\'' => true, '"' => true, '`' => true];
     
         /**
          * Contains the default options for minification. This array is merged with
    @@ -86,7 +93,7 @@ class Minifier
          *
          * @var array
          */
    -    protected static $defaultOptions = array('flaggedComments' => true);
    +    protected static $defaultOptions = ['flaggedComments' => true];
     
         /**
          * Contains lock ids which are used to replace certain code patterns and
    @@ -94,7 +101,7 @@ class Minifier
          *
          * @var array
          */
    -    protected $locks = array();
    +    protected $locks = [];
     
         /**
          * Takes a string containing javascript and removes unneeded characters in
    @@ -105,7 +112,7 @@ class Minifier
          * @throws \Exception
          * @return bool|string
          */
    -    public static function minify($js, $options = array())
    +    public static function minify($js, $options = [])
         {
             try {
                 ob_start();
    @@ -157,21 +164,34 @@ protected function minifyDirectToOutput($js, $options)
         protected function initialize($js, $options)
         {
             $this->options = array_merge(static::$defaultOptions, $options);
    -        $js = str_replace("\r\n", "\n", $js);
    -        $js = str_replace('/**/', '', $js);
    -        $this->input = str_replace("\r", "\n", $js);
    +        $this->input = str_replace(["\r\n", '/**/', "\r"], ["\n", "", "\n"], $js);
     
             // We add a newline to the end of the script to make it easier to deal
             // with comments at the bottom of the script- this prevents the unclosed
             // comment error that can otherwise occur.
             $this->input .= PHP_EOL;
     
    +        // save input length to skip calculation every time
    +        $this->len = strlen($this->input);
    +
             // Populate "a" with a new line, "b" with the first character, before
             // entering the loop
             $this->a = "\n";
             $this->b = $this->getReal();
         }
     
    +    /**
    +     * Characters that can't stand alone preserve the newline.
    +     *
    +     * @var array
    +     */
    +    protected $noNewLineCharacters = [
    +        '(' => true,
    +        '-' => true,
    +        '+' => true,
    +        '[' => true,
    +        '@' => true];
    +
         /**
          * The primary action occurs here. This function loops through the input string,
          * outputting anything that's relevant and discarding anything that is not.
    @@ -183,7 +203,7 @@ protected function loop()
                     // new lines
                     case "\n":
                         // if the next line is something that can't stand alone preserve the newline
    -                    if ($this->b !== false && strpos('(-+[@', $this->b) !== false) {
    +                    if ($this->b !== false && isset($this->noNewLineCharacters[$this->b])) {
                             echo $this->a;
                             $this->saveString();
                             break;
    @@ -226,7 +246,7 @@ protected function loop()
                                     break;
                                 }
     
    -                                // no break
    +                        // no break
                             default:
                                 // check for some regex that breaks stuff
                                 if ($this->a === '/' && ($this->b === '\'' || $this->b === '"')) {
    @@ -257,6 +277,7 @@ protected function loop()
         protected function clean()
         {
             unset($this->input);
    +        $this->len = 0;
             $this->index = 0;
             $this->a = $this->b = '';
             unset($this->c);
    @@ -276,7 +297,7 @@ protected function getChar()
                 unset($this->c);
             } else {
                 // Otherwise we start pulling from the input.
    -            $char = substr($this->input, $this->index, 1);
    +            $char = $this->index < $this->len ? $this->input[$this->index] : false;
     
                 // If the next character doesn't exist return false.
                 if (isset($char) && $char === false) {
    @@ -289,7 +310,7 @@ protected function getChar()
     
             // Normalize all whitespace except for the newline character into a
             // standard space.
    -        if ($char !== "\n" && ord($char) < 32) {
    +        if ($char !== "\n" && $char < "\x20") {
                 return ' ';
             }
     
    @@ -340,7 +361,7 @@ protected function getReal()
          */
         protected function processOneLineComments($startIndex)
         {
    -        $thirdCommentString = substr($this->input, $this->index, 1);
    +        $thirdCommentString = $this->index < $this->len ? $this->input[$this->index] : false;
     
             // kill rest of line
             $this->getNext("\n");
    @@ -429,7 +450,7 @@ protected function getNext($string)
             $this->index = $pos;
     
             // Return the first character of that string.
    -        return substr($this->input, $this->index, 1);
    +        return $this->index < $this->len ? $this->input[$this->index] : false;
         }
     
         /**
    @@ -447,7 +468,7 @@ protected function saveString()
             $this->a = $this->b;
     
             // If this isn't a string we don't need to do anything.
    -        if (!in_array($this->a, $this->stringDelimiters)) {
    +        if (!isset($this->stringDelimiters[$this->a])) {
                 return;
             }
     
    @@ -557,7 +578,7 @@ protected function lock($js)
             /* lock things like <code>"asd" + ++x;</code> */
             $lock = '"LOCK---' . crc32(time()) . '"';
     
    -        $matches = array();
    +        $matches = [];
             preg_match('/([+-])(\s+)([+-])/S', $js, $matches);
             if (empty($matches)) {
                 return $js;
    
    1. Run composer install -vvv

    Expected The patch should be applied

    Actual Patch applying failing with "No such file or directory" error: image

    image

    Notes The directory of the package is empty after the command failure image

    bug 
    opened by ihor-sviziev 11
  • Support for Composer v2

    Support for Composer v2

    New major version for Composer is on the horizon and will introduce new plugin API:

    https://php.watch/articles/composer-2#plugin-api-2

    Describe the solution you'd like Make sure that this plugin complies to said changes (probably requires new MAJOR release).

    enhancement 
    opened by allanpaiste 11
  • Composer mirrors are not used on patch install like private packagist

    Composer mirrors are not used on patch install like private packagist

    Composer mirrors are not used on patch install like private packagist

    To Reproduce Steps to reproduce the behavior:

    1. Download magento 2 (e.g. composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition <install-directory-name> | see: https://devdocs.magento.com/guides/v2.4/install-gde/composer.html#get-the-metapackage)
    2. Open composer.json and edit repositories to include your repo e.g.:
        "repositories": {
            "packagist.org": false,
            "private-packagist": {
                "type": "composer",
                "url": "https://repo.packagist.com/YOUR-COMPANY/"
            }
        },
    
    1. Run composer update to update repos for composer.lock
    2. Open composer.json again and add a patch e.g.:
        "extra": {
            "magento-force": "override",
            "patches": {
                "*": {
                    "Apply MDVA-43395": {
                        "source": "patches/magento/MDVA-43395_EE_2.4.3-p1_COMPOSER_v1.patch",
                        "targets": [
                            "magento/framework",
                            "magento/module-email"
                        ]
                    },
                    "Apply MDVA-43443": {
                        "source": "patches/magento/MDVA-43443_EE_2.4.2-p2_COMPOSER_v1.patch",
                        "targets": [
                            "magento/framework",
                            "magento/module-email"
                         ],
                         "after": "MDVA-43395_EE_2.4.3-p1_COMPOSER_v1.patch"
                    }
                }
            }
        }
    
    1. Be sure to not have credentials saved for repo.magento.com in the auth.json. It should only include the repo.packagist.com credentials.
    2. [VERY IMPORTANT] Run composer clear-cache so no cache is used for applying the patch. (Else it will work just fine because of the cached files from the download before)
    3. Run composer install or composer patch:apply

    Expected It should apply the patch or at least download the package from the private packagist.

    Actual It tries to download the package from repo.magento.com (which it should not) image

    Notes This is probably somewhat related / "caused" by #71

    opened by Morgy93 9
  • Cannot be used with PHP version over 5.6

    Cannot be used with PHP version over 5.6

    drupol/phposinfo 1.6.1.2 requires php ^5.3 || ^5.4 || ^5.5 || ^5.6 -> your PHP version (7) does not satisfy that requirement.

    The dependency does not allow php version over 5.6.

    bug 
    opened by ronald2wing 8
  • error on patch

    error on patch

    hi

    we have an issue on composer

    Generating autoload files Processing patches configuration Nothing to patch PHP Fatal error: Uncaught Error: Call to a member function setExtra() on array in /var/webroot/vendor/vaimo/composer-patches/src/Bootstrap.php:110 Stack trace: #0 /var/webroot/vendor/vaimo/composer-patches/src/Plugin.php(65): Vaimo\ComposerPatches\Bootstrap->sanitizeLocker(Object(Composer\Package\Locker)) #1 [internal function]: Vaimo\ComposerPatches\Plugin->postInstall(Object(Composer\Script\Event)) #2 phar:///home/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php(176): call_user_func(Array, Object(Composer\Script\Event)) #3 phar:///home/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php(96): Composer\EventDispatcher\EventDispatcher->doDispatch(Object(Composer\Script\Event)) #4 phar:///home/composer.phar/src/Composer/Autoload/AutoloadGenerator.php(111): Composer\EventDispatcher\EventDispatcher->dispatchScript('pre-autoload-du...', true, Array, Array) #5 phar:///home/composer.phar/ in /var/webroot/vendor/vaimo/composer-patches/src/Bootstrap.php on line 110

    Fatal error: Uncaught Error: Call to a member function setExtra() on array in /var/webroot/vendor/vaimo/composer-patches/src/Bootstrap.php:110 Stack trace: #0 /var/webroot/vendor/vaimo/composer-patches/src/Plugin.php(65): Vaimo\ComposerPatches\Bootstrap->sanitizeLocker(Object(Composer\Package\Locker)) #1 [internal function]: Vaimo\ComposerPatches\Plugin->postInstall(Object(Composer\Script\Event)) #2 phar:///home/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php(176): call_user_func(Array, Object(Composer\Script\Event))

    did you know why?

    bug 
    opened by ucola 8
  • Patch:* commands not available if plugin installed globally and composer.phar is run in project context

    Patch:* commands not available if plugin installed globally and composer.phar is run in project context

    using a global installed composer.phar (c:\bin\composer.phar, which is in the PATH) i used composer global require hirak/prestissimo and it is also loaded for my projects. so there was no need to install it with the projects dependencies.

    Plugin packages are automatically loaded as soon as they are installed and will be loaded when composer starts up if they are found in the current project's list of installed packages. Additionally all plugin packages installed in the COMPOSER_HOME directory using the composer global command are loaded before local project plugins are loaded.

    https://getcomposer.org/doc/articles/plugins.md#using-plugins

    the composer docs let me assume that this is the intended behavior.

    i installed vaimo/composer-patches the same way with composer global require vaimo/composer-patches but running php composer.phar in my projects dir, does not list the patch:* commands. shouldn't they be there even if its installed globally?

    λ composer patch:list --from-source -vvv                                                                                           
    converting composer.yaml to json                                                                                                   
    Reading ./composer.json                                                                                                            
    Loading config file C:/Users/username/AppData/Roaming/Composer/config.json                                                         
    Loading config file C:/Users/username/AppData/Roaming/Composer/auth.json                                                           
    Loading config file ./composer.json                                                                                                
    Checked CA file xxxxx.pem: valid                                      
    Executing command (C:\home\projects\project\src): git branch --no-color --no-abbrev -v                             
    Reading C:/Users/username/AppData/Roaming/Composer/composer.json                                                                   
    Loading config file C:/Users/username/AppData/Roaming/Composer/config.json                                                         
    Loading config file C:/Users/username/AppData/Roaming/Composer/auth.json                                                           
    Loading config file C:/Users/username/AppData/Roaming/Composer/composer.json                                                       
    Reading C:\home\projects\project\src/vendor/composer/installed.json                                                
    Reading C:/Users/username/AppData/Roaming/Composer/vendor/composer/installed.json                                                  
    Loading plugin PackageVersions\Installer                                                                                           
    Loading plugin Symfony\Flex\Flex                                                                                                   
    Loading plugin Bamarni\Composer\Bin\Plugin                                                                                         
    Loading plugin Studio\Composer\StudioPlugin                                                                                        
    Loading plugin Fxp\Composer\AssetPlugin\FxpAssetPlugin                                                                             
    Loading plugin Hirak\Prestissimo\Plugin                                                                                            
    Loading plugin Pyrech\ComposerChangelogs\ChangelogsPlugin                                                                          
    Loading plugin Rubenrua\SymfonyCleanTagsComposerPlugin\Plugin                                                                      
    symfony/flex is active: Skip the activation                                                                                        
    Loading plugin Vaimo\ComposerPatches\Plugin                                                                                        
    Running 1.8.4 (2019-02-11 10:52:10) with PHP 7.3.9 on Windows NT / 6.1                                                             
                                                                                                                                       
                                                                                                                                       
      [Symfony\Component\Console\Exception\CommandNotFoundException]                                                                   
      There are no commands defined in the "patch" namespace.                                                                          
    
    wontfix 
    opened by c33s 6
  • patch: unrecognized option `--verbose' (FreeBSD)

    patch: unrecognized option `--verbose' (FreeBSD)

    A clear and concise description of what the bug is.

    Pre-requisites

    1. Have a project with patches
    2. have patch applier at version 'patch 2.0-12u11 FreeBSD'

    To Reproduce Steps to reproduce the behavior:

    1. composer patch:apply -vvv

    Expected No errors

    Actual Executing command (content/plugins/autoptimize/): /usr/bin/patch -t --verbose -p'1' --no-backup-if-mismatch --dry-run < '[site-path]/patches/autoptimize/2.5.1/html-fix-no-style-in-footer.patch' patch: unrecognized option `--verbose' usage: patch [-bCcEeflNnRstuv] [-B backup-prefix] [-D symbol] [-d directory] [-F max-fuzz] [-i patchfile] [-o out-file] [-p strip-count] [-r rej-name] [-V t | nil | never | none] [-x number] [-z backup-ext] [--posix] [origfile [patchfile]] patch <patchfile

    Notes Works fine with 'GNU patch 2.7.6', that i have on my local machine, but not on the FreeBSD version at the server.

    bug 
    opened by puggan 6
  • Patch error on large composer update

    Patch error on large composer update

    Sometimes on large scale composer updates I get following error when the patches are supposed to be applied:

    Fatal error: Uncaught ArgumentCountError: Too few arguments to function Vaimo\ComposerPatches\Package\InfoResolver::__construct(), 1 passed in /builds/.../vendor/vaimo/composer-patches/src/Factories/PatchesLoaderFactory.php on line 48 and exactly 2 expected in /builds/.../vendor/vaimo/composer-patches/src/Package/InfoResolver.php:36
    Stack trace:
    #0 /builds/.../vendor/vaimo/composer-patches/src/Factories/PatchesLoaderFactory.php(48): Vaimo\ComposerPatches\Package\InfoResolver->__construct(Object(Composer\Installer\InstallationManager))
    #1 /builds/.../vendor/vaimo/composer-patches/src/Bootstrap.php(122): Vaimo\ComposerPatches\Factories\PatchesLoaderFactory->create(Object(Vaimo\ComposerPatches\Patch\DefinitionList\Loader\ComponentPool), Object(Vaimo\ComposerPatches\Config), true)
    #2 /builds/.../vendor/vaimo/composer-patches/src/Bootstrap.php(102): Vaimo\ComposerPatches\Boo in /builds/.../vendor/vaimo/composer-patches/src/Package/InfoResolver.php on line 36
    PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function Vaimo\ComposerPatches\Package\InfoResolver::__construct(), 1 passed in /builds/.../vendor/vaimo/composer-patches/src/Factories/PatchesLoaderFactory.php on line 48 and exactly 2 expected in /builds/.../vendor/vaimo/composer-patches/src/Package/InfoResolver.php:36
    Stack trace:
    #0 /builds/.../vendor/vaimo/composer-patches/src/Factories/PatchesLoaderFactory.php(48): Vaimo\ComposerPatches\Package\InfoResolver->__construct(Object(Composer\Installer\InstallationManager))
    #1 /builds/.../vendor/vaimo/composer-patches/src/Bootstrap.php(122): Vaimo\ComposerPatches\Factories\PatchesLoaderFactory->create(Object(Vaimo\ComposerPatches\Patch\DefinitionList\Loader\ComponentPool), Object(Vaimo\ComposerPatches\Config), true)
    #2 /builds/.../vendor/vaimo/composer-patches/src/Bootstrap.php(102): Vaimo\ComposerPatches\Boo in /builds/.../vendor/vaimo/composer-patches/src/Package/InfoResolver.php on line 36`
    
    Did anyone see this before? I am not quite sure how to reproduce it.
    bug 
    opened by DanieliMi 6
  • [WIP] Started working on composer v2 support

    [WIP] Started working on composer v2 support

    This is (or was) an attempt at making this module compatible with composer v2 in scope of https://github.com/vaimo/composer-patches/issues/59

    However, I think I will give up on this, I'm not familiar enough with the codebase or with composer's internals. Maybe the changes in here can be useful in case somebody else wants to pick this up later...

    Remarks:

    • PR was created from the release/3 branch since I'm using macOs and only on that branch the built-in unit tests seems to be running without many issues (maybe those commits could be merged in master one day?)
    • I temporarily removed the dependency on vaimo/composer-changelogs since that one also doesn't support composer v2 yet: https://github.com/vaimo/composer-changelogs/issues/3
    • It's very difficult to keep supporting both composer v1 and v2 due to many internal calls to the composer source which have changed significantly between v1 and v2. Therefore I only declared the module as compatible with v2
    • I got a bunch of tests working when executing composer code:test but unfortunately not all of them
    • All changes I present in here should be investigated, I only tried to make the code run without errors but didn't check if it actually executed what it is supposed to execute since I'm not familiar with how composer works internally
    • These changes will probably warrant a major v5 version as they are not backwards compatible with composer v1

    Hoping that the work done in here is useful to the next person who attempts this 🙂

    opened by hostep 5
  • Reversed patch application not detected, causing upstream fix to be removed

    Reversed patch application not detected, causing upstream fix to be removed

    In my project I have a simple one-line addition patch, that was applied upstream in a new version of the targeted composer package. Due to this, the patch command invocation detected that this is an already applied patch, and applied the patch in reverse, effectively removing the fix from the package.

    From the example 'operation-failures' configuration I assume that this is supposed to be treated as an error condition, as it checks for reversals, but this doesn't seem to happen.

    Expected Non-application of patch, or warning/error stating patch is already applied (so we can clean up or restrict our patches to appropriate package versions)

    Actual Reverse application of patch, effectively removing the upstream fix causing the issue the patch was meant to fix to return

    Notes Full verbose output of patch application process:

      - Applying patches for adyen/module-payment (1)
        ~ reach-digital/project-grandvision: composer-patches/adyen-module-payment-fix-csrf-validation.patch [NEW]
          Fix CSRF validation with Magento 2.3.2
          Executing command (/data/web/magento2/vendor/adyen/module-payment): which patch
          /usr/bin/patch
          Executing command (/data/web/magento2/vendor/adyen/module-payment): /usr/bin/patch -t --verbose -p'0' --no-backup-if-mismatch --dry-run < '/data/web/magento2/composer-patches/adyen-module-payment-fix-csrf-validation.patch'
          Hmm...  Looks like a unified diff to me...
          can't find file to patch at input line 8
          Perhaps you used the wrong -p or --strip option?
          The text leading up to this was:
          --------------------------
          |Fix CSRF validation with Magento 2.3.2
          |
          |@package adyen/module-payment
          |
          |diff -Nru adyen/module-payment_orig/Controller/Process/Json.php adyen/module-payment/Controller/Process/Json.php
          |--- adyen/module-payment_orig/Controller/Process/Json.php	2019-08-16 11:35:13.714588586 +0000
          |+++ adyen/module-payment/Controller/Process/Json.php	2019-08-16 11:35:31.410547035 +0000
          --------------------------
          No file to patch.  Skipping patch.
          Hunk #1 ignored at 75.
          1 out of 1 hunk ignored
          done
          Validation (type=PATCH) failed with p=0
          Executing command (/data/web/magento2/vendor/adyen/module-payment): which git
          /usr/bin/git
          *** The expected result to execution is a failure***
          Executing command (/data/web/magento2/vendor/adyen/module-payment): cd .. && /usr/bin/git rev-parse --is-inside-work-tree
          true
          Usability test (type=GIT) failed with p=0
          Executing command (/data/web/magento2/vendor/adyen/module-payment): /usr/bin/patch -t --verbose -p'1' --no-backup-if-mismatch --dry-run < '/data/web/magento2/composer-patches/adyen-module-payment-fix-csrf-validation.patch'
          Hmm...
          Looks like a unified diff to me...
          can't find file to patch at input line 8
          Perhaps you used the wrong -p or --strip option?
          The text leading up to this was:
          --------------------------
          |Fix CSRF validation with Magento 2.3.2
          |
          |@package adyen/module-payment
          |
          |diff -Nru adyen/module-payment_orig/Controller/Process/Json.php adyen/module-payment/Controller/Process/Json.php
          |--- adyen/module-payment_orig/Controller/Process/Json.php	2019-08-16 11:35:13.714588586 +0000
          |+++ adyen/module-payment/Controller/Process/Json.php	2019-08-16 11:35:31.410547035 +0000
          --------------------------
          No file to patch.  Skipping patch.
          Hunk #1 ignored at 75.
          1 out of 1 hunk ignored
          done
          Validation (type=PATCH) failed with p=1
          *** The expected result to execution is a failure***
          Usability test (type=GIT) failed with p=1
          Executing command (/data/web/magento2/vendor/adyen/module-payment): /usr/bin/patch -t --verbose -p'2' --no-backup-if-mismatch --dry-run < '/data/web/magento2/composer-patches/adyen-module-payment-fix-csrf-validation.patch'
          Hmm...  Looks like a unified diff to me...
          The text leading up to this was:
          --------------------------
          |Fix CSRF validation with Magento 2.3.2
          |
          |@package adyen/module-payment
          |
          |diff -Nru adyen/module-payment_orig/Controller/Process/Json.php adyen/module-payment/Controller/Process/Json.php
          |--- adyen/module-payment_orig/Controller/Process/Json.php	2019-08-16 11:35:13.714588586 +0000
          |+++ adyen/module-payment/Controller/Process/Json.php	2019-08-16 11:35:31.410547035 +0000
          --------------------------
          checking file Controller/Process/Json.php
          Using Plan A...
          Reversed (or previously applied) patch detected!  Assuming -R.
          Hunk #1 succeeded at 83 with fuzz 2 (offset 8 lines).
          done
          Executing command (/data/web/magento2/vendor/adyen/module-payment): /usr/bin/patch -t -p'2' --no-backup-if-mismatch < '/data/web/magento2/composer-patches/adyen-module-payment-fix-csrf-validation.patch'
          patching file Controller/Process/Json.php
          Reversed (or previously applied) patch detected!  Assuming -R.
          Hunk #1 succeeded at 83 with fuzz 2 (offset 8 lines).
          SUCCESS with type=PATCH (p=2)
    
    Writing patch info to install file
    

    Patch contents:

    Fix CSRF validation with Magento 2.3.2
    
    @package adyen/module-payment
    
    diff -Nru adyen/module-payment_orig/Controller/Process/Json.php adyen/module-payment/Controller/Process/Json.php
    --- adyen/module-payment_orig/Controller/Process/Json.php	2019-08-16 11:35:13.714588586 +0000
    +++ adyen/module-payment/Controller/Process/Json.php	2019-08-16 11:35:31.410547035 +0000
    @@ -75,6 +75,7 @@
                 $request = $this->getRequest();
                 if ($request instanceof HttpRequest && $request->isPost()) {
                     $request->setParam('isAjax', true);
    +                $request->getHeaders()->addHeaderLine('X_REQUESTED_WITH', 'XMLHttpRequest');
                 }
             }
         }
    
    

    Targeted composer package +version: adyen/module-payment 5.0.2

    bug 
    opened by hnsr 5
  • Unzip error on applying new patches when composer cache is cleared.

    Unzip error on applying new patches when composer cache is cleared.

    When we clear composer cache and try to apply new patches an unzip error is thrown, saying that it cannot find or open the file.

    Pre-requisites

    1. Composer 2.1.14 or 2.2.18
    2. vaimo/composer-patches 5.1.0

    To Reproduce Steps to reproduce the behavior:

    1. Add a few patches to composer.json
    2. Clear composer cache (Important)
    3. Run composer install

    Expected The module that needs to be patched downloads and unzips properly and the patch gets applied

    Actual The module gets downloaded as I can see the temporary zip file in vendor/composer. But for some reason unzip cannot find and open the file. Below is an example of the error that is seen.

    Downloading magento/module-catalog (104.0.3-p1)
     - Installing magento/module-catalog (104.0.3-p1): Extracting archive
     - Downloading magento/module-customer (103.0.3-p1)
     - Installing magento/module-customer (103.0.3-p1): Extracting archive
       Failed to extract magento/module-catalog: (9) '/usr/bin/unzip' -qq '/var/www/public_html/vendor/composer/tmp-4820c41c8fed26c02f46957144d3b7b6.zip' -d '/var/www/public_html/vendor/composer/a4cc12cf'
    
    unzip:  cannot find or open /var/www/public_html/vendor/composer/tmp-4820c41c8fed26c02f46957144d3b7b6.zip.
    
       This most likely is due to a custom installer plugin not handling the returned Promise from the downloader
       See https://github.com/composer/installers/commit/5006d0c28730ade233a8f42ec31ac68fb1c5c9bb for an example fix
       Failed to extract magento/module-customer: (9) '/usr/bin/unzip' -qq '/var/www/public_html/vendor/composer/tmp-6a61d82997a557739499394c58ee4a19.zip' -d '/var/www/public_html/vendor/composer/f34b6162'
    
    unzip:  cannot find or open /var/www/public_html/vendor/composer/tmp-6a61d82997a557739499394c58ee4a19.zip.
    
       This most likely is due to a custom installer plugin not handling the returned Promise from the downloader
       See https://github.com/composer/installers/commit/5006d0c28730ade233a8f42ec31ac68fb1c5c9bb for an example fix
    

    Notes If you run composer install a couple of times the module gets unzipped properly and the patch is applied. I have found that this bug has been introduced in composer-patches 5.0.0 in the commit Uninstall package during ReInstallOperation for Composer v2 Below are the lines of code from the file src/Compatibility/Executor.php (line 88) that causes the behavior.

    return $installationManager
               ->uninstall($repository, $uninstallOperation)
               ->then(function()  use ($installer, $package) {
                   $installer->download($package);
               })
               ->then(function () use ($installationManager, $installOperation, $repository) {
                   $installationManager->install($repository, $installOperation);
               });
    

    If we replace it with the code

     $installationManager
                ->uninstall($repository, $uninstallOperation);
    
            return $installer
                    ->download($package)
                ->then(function () use ($installationManager, $installOperation, $repository) {
                    $installationManager->install($repository, $installOperation);
                });
    

    the patches apply properly even when composer cache is cleared. It looks like the promise is not working for the uninstall function, but I need more input here.

    opened by jupiterhs 0
  • PHP 8.1 Deprecated error for package in the dependency

    PHP 8.1 Deprecated error for package in the dependency

    Hi Its not critical but anyway vaimo composer patches using vaimo/topological-sort topological-sort contains some deprecated code for PHP 8.1 I cant find new versions for topological-sort According to the README - topological-sort needed for PHP 5.3 Do you really need to have it? Screenshot from 2022-10-28 18-15-00

    Thanks

    opened by boris1988 0
  • Fix false-positive when determining if patcher (current package) is going to be uninstalled

    Fix false-positive when determining if patcher (current package) is going to be uninstalled

    When a package that is really going to be deleted defines a "Vaimo" namespace in its PSR-4 autoload, then vaimo/composer patches decides that it is going to be deleted and wipes out patches.

    It happens because strpos("Vaimo\ComposerPatches", "Vaimo") indeed returns 0.

    Steps to Reproduce

    1. Have a package that defines "Vaimo" as it's root namespace (I've encountered this issue having vaimo/phpcs-rulesets installed as a --dev dependency).
    2. Require it as a --dev dependency in a project that has vaimo/composer-patches installed as production dependency
    3. Run composer install --no-dev
    4. Observe your patches being wiped out.
    opened by enl 1
  • Error during Ci/CD

    Error during Ci/CD

    Do you have any Ideas, why i get this error?

    > pre-autoload-dump: Vaimo\ComposerPatches\Plugin->postInstall
    Processing patches configuration
      - Removing league/fractal (0.19.2)
    Executing async command (CWD): rm -rf '/builds/builder/backend/vendor/league/fractal'
      - Downloading league/fractal (0.19.2)
    Downloading https:/api.github.com/repos/thephpleague/fractal/zipball/06dc15f6ba38f2dde2f919d3095d13b571190a7c
      - Installing league/fractal (0.19.2): Extracting archive
    Executing async command (CWD): '/usr/bin/unzip' -qq '/builds/builder/backend/vendor/composer/tmp-d28b9e921dd7aa5a20cb8b543f1f5182' -d '/builds/builder/backend/vendor/composer/5915b398'
    Executing command (CWD): rm -rf '/builds/builder/backend/vendor/composer/5915b398'
    Executing command (CWD): rm -rf '/builds/builder/backend/vendor/league/fractal'
    [302] https:/api.github.com/repos/thephpleague/fractal/zipball/06dc15f6ba38f2dde2f919d3095d13b571190a7c
    Following redirect (1) https:/codeload.github.com/thephpleague/fractal/legacy.zip/06dc15f6ba38f2dde2f919d3095d13b571190a7c
    [200] https:/codeload.github.com/thephpleague/fractal/legacy.zip/06dc15f6ba38f2dde2f919d3095d13b571190a7c
      - Applying patches for league/fractal (1)
        ~ laravel/laravel: patches/thephpleague/fractal/ReturnTypeWillChange.patch [NEW]
          fix ReturnTypeWillChange)
          Executing command (/builds/builder/backend/vendor/league/fractal): which patch
          The provided cwd "/builds/builder/backend/vendor/league/fractal" does not exist.
          #0 phar://usr/local/bin/composer/vendor/symfony/process/Process.php(252): Symfony\Component\Process\Process->start(Object(Closure), Array)
          #1 phar://usr/local/bin/composer/src/Composer/Util/ProcessExecutor.php(128): Symfony\Component\Process\Process->run(Object(Closure))
    
    opened by beeyev 1
  • Add feature to allow a specific patch to fail

    Add feature to allow a specific patch to fail

    Is your feature request related to a problem? Please describe. I have a patch that fails right now, but could pass in the future (due to circumstances not relevant to the case). I would like to have it fail now but succeed eventually.

    Describe the solution you'd like The option graceful has been added but this applies to the whole patch command. If I were to set graceful to true, all my other patches would also be allowed to fail, which I don't want.

    Describe alternatives you've considered Right now, I add @skip but that needs to removed when we upgrade the package and this is sometimes forgotten.

    Additional context I'd like to have a @graceful embedded meta-data field to allow a specific patch to fail without halting the entire patch command.

    opened by peterjaap 0
  • Per-patch applier / parameter configurations

    Per-patch applier / parameter configurations

    I have one composer module that requires different applier settings (--binary) than the rest of the patches.

    I tried several different configuration unsuccessfully:

        "extra": {
            "patches": {
                "vendor1/package1": {
                    "a patch": "patches/vendor/vendor1/package1/patch1.patch"
                },
                "vendor2/package2": {
                    "a patch": "patches/vendor/vendor2/package2/patch2.patch"
                },
                "vendor3/package3": {
                    "a patch with special applier": "patches/vendor/vendor3/package3/patch3.patch",
                    "_config": {
                        "patcher": {
                            "appliers": {
                                "PATCH": {
                                    "check": {
                                        "default": "[[bin]] -t --verbose -p{{level}} --no-backup-if-mismatch --binary --dry-run < {{file}}"
                                    },
                                    "patch": {
                                        "default": "[[bin]] -t -p{{level}} --no-backup-if-mismatch --binary < {{file}}"
                                    }
                                }
                            }
                        }
                    }
                }
             }
        },
    
        "extra": {
            "patches": {
                "vendor1/package1": {
                    "a patch": "patches/vendor/vendor1/package1/patch1.patch"
                },
                "vendor2/package2": {
                    "a patch": "patches/vendor/vendor2/package2/patch2.patch"
                },
                "vendor3/package3": {
                    "a patch with special applier": {
                        "source": "patches/vendor/vendor3/package3/patch3.patch",
                        "patcher": {
                            "appliers": {
                                "PATCH": {
                                    "check": {
                                        "default": "[[bin]] -t --verbose -p{{level}} --no-backup-if-mismatch --binary --dry-run < {{file}}"
                                    },
                                    "patch": {
                                        "default": "[[bin]] -t -p{{level}} --no-backup-if-mismatch --binary < {{file}}"
                                    }
                                }
                            }
                        }
                    }
                }
             }
        },
    

    Unfortunately none of them succeeded. Is this currently not possible to do on a per patch or module level?

    opened by heldchen 0
Releases(5.1.0)
  • 5.1.0(Jul 8, 2022)

  • 5.0.0(May 13, 2022)

    • Fix PHP 8.1 deprecation notices: https://github.com/vaimo/composer-patches/pull/96
    • Add conflict with cweagans/composer-patches: https://github.com/vaimo/composer-patches/pull/94
    • Uninstall package during ReInstallOperation for Composer v2 https://github.com/vaimo/composer-patches/pull/99
    Source code(tar.gz)
    Source code(zip)
  • 4.22.4(Feb 25, 2021)

    changes in this release forward-ported from 3.53.4

    Fix

    • bundled patches fail to apply when using patch-mapping configuration due to refactored code in 3.53.2 having messed up argument order used for a sub-function call in BasePathComponent

    Links: src diff

    Source code(tar.gz)
    Source code(zip)
  • 3.53.4(Feb 25, 2021)

    Fix

    • bundled patches fail to apply when using patch-mapping configuration due to refactored code in 3.53.2 having messed up argument order used for a sub-function call in BasePathComponent

    Links: src diff

    Source code(tar.gz)
    Source code(zip)
  • 4.22.3(Feb 24, 2021)

    changes in this release forward-ported from 3.53.3

    Fix

    • patch applier crash when branch alias defined for root package (scenario: root-branch-alias) [pull/73]

    Maintenance

    • make patch commands available when the plugin itself is a root package (just for the sake of allowing people to conduct quick experiments when developing)

    Links: src diff

    Source code(tar.gz)
    Source code(zip)
  • 4.22.2(Feb 24, 2021)

    changes in this release forward-ported from 3.53.2

    Fix

    • patches applied before packages properly re-installed with Composer V2 (missed the fact that installations, like downloads are now done in asynchronous manner) [issues/70]

    Links: src diff

    Source code(tar.gz)
    Source code(zip)
  • 3.53.3(Feb 24, 2021)

    Fix

    • patch applier crash when branch alias defined for root package (scenario: root-branch-alias) [pull/73]

    Maintenance

    • make patch commands available when the plugin itself is a root package (just for the sake of allowing people to conduct quick experiments when developing)

    Links: src diff

    Source code(tar.gz)
    Source code(zip)
  • 3.53.2(Feb 24, 2021)

    Fix

    • patches applied before packages properly re-installed with Composer V2 (missed the fact that installations, like downloads are now done in asynchronous manner) [issues/70]

    Links: src diff

    Source code(tar.gz)
    Source code(zip)
  • 4.22.1(Feb 20, 2021)

    changes in this release forward-ported from 3.53.1

    Fix

    • minor issue addressed with V2-style call being in code without version-check (said call is currently backwards-compatible with V1, but you never know ...)

    Links: src diff

    Source code(tar.gz)
    Source code(zip)
  • 4.22.0(Feb 20, 2021)

    changes in this release forward-ported from 3.53.0

    Feature

    • add support for Composer 2 [issues/59]
    • allow patcher operations to be optionally disabled by re-declarng them with label replaced with: false

    Maintenance

    • introduce ready-to-use development environment setup for quicker developer onboarding [issues/65]
    • improved linter rules to be a it less forgiving on excessive use of whitespace
    • fix an issue where GIT applier was polled within the tests (due to there being repo-within-repo situation which made the applier to be excluded)

    Links: src diff

    Source code(tar.gz)
    Source code(zip)
  • 3.53.1(Feb 20, 2021)

    Fix

    • minor issue addressed with V2-style call being in code without version-check (said call is currently backwards-compatible with V1, but you never know ...)

    Links: src diff

    Source code(tar.gz)
    Source code(zip)
  • 3.53.0(Feb 20, 2021)

    Feature

    • add support for Composer 2 [issues/59]
    • allow patcher operations to be optionally disabled by re-declarng them with label replaced with: false

    Maintenance

    • introduce ready-to-use development environment setup for quicker developer onboarding [issues/65]
    • improved linter rules to be a it less forgiving on excessive use of whitespace
    • fix an issue where GIT applier was polled within the tests (due to there being repo-within-repo situation which made the applier to be excluded)

    Links: src diff

    Source code(tar.gz)
    Source code(zip)
  • 4.21.1(Jan 31, 2021)

    changes in this release forward-ported from 3.52.1

    Fix

    • remove patch availability validation crash under certain package setups

    Maintenance

    • improve test coverage to include scenarios where the patches are owned by a sub-package rather than the root

    Links: src diff

    Source code(tar.gz)
    Source code(zip)
  • 4.21.0(Feb 4, 2021)

    changes in this release forward-ported from 3.52.0

    Feature

    • allow global usage of the plugin when explicitly enabled via environment variable: COMPOSER_PATCHER_ALLOW_GLOBAL_USAGE (pull/45)

    Fix

    • added /F switch to where to add double quotes to windows commands (pull/44)
    • added no-scripts option to avoid executing post-install-cmd (pull/48)
    • strpos() empty needle errors can occur with certain configurations (pull/53)
    • patches-searches path containing .patch fails (pull/58) (with extra modifications)

    Maintenance

    • CI config fixed to use Composer 1.X
    • make it possible to run tests while developing the module on MacOS
    • make sure output assertions on tests don't fail on small terminal windows when composer output gets wrapped
    • update compatibility checker not to fail on false-negatives
    • fix normalizer script not executing as expected after code:deps run

    Links: src diff

    Source code(tar.gz)
    Source code(zip)
  • 3.52.1(Jan 31, 2021)

    Fix

    • remove patch availability validation crash under certain package setups

    Maintenance

    • improve test coverage to include scenarios where the patches are owned by a sub-package rather than the root

    Links: src diff

    Source code(tar.gz)
    Source code(zip)
  • 3.52.0(Jan 31, 2021)

    Feature

    • allow global usage of the plugin when explicitly enabled via environment variable: COMPOSER_PATCHER_ALLOW_GLOBAL_USAGE (pull/45)

    Fix

    • added /F switch to where to add double quotes to windows commands (pull/44)
    • added no-scripts option to avoid executing post-install-cmd (pull/48)
    • strpos() empty needle errors can occur with certain configurations (pull/53)
    • patches-searches path containing .patch fails (pull/58) (with extra modifications)

    Maintenance

    • CI config fixed to use Composer 1.X
    • make it possible to run tests while developing the module on MacOS
    • make sure output assertions on tests don't fail on small terminal windows when composer output gets wrapped
    • update compatibility checker not to fail on false-negatives
    • fix normaliser script not executing as expected after code:deps run

    Links: src diff

    Source code(tar.gz)
    Source code(zip)
  • 4.16.1(Jun 19, 2019)

    All features and fixes in this release are forward-ported from 3.47.1

    Fix

    • wrong path used for pre-loading classes while running composer commands when the plugin package used as ROOT
    • removed all syntax/code that was not compatible with 5.3
    • removed/replaced all dependencies that were not compatible with 5.3
    • having a patch for a back-ported fix for a package where when the package gets updated, the update could cause reverse-apply of the patch, thus reintroducing issue that was fixed in newer release (only happens with patches that should be declared with upper-capped version constraints but are not for some reason). This will cause patch failure from now on
    • don't provide patch commands when plugin on older (<1.1) Composer versions [github/31]
    • always load patches in alphabetical order from file-system when using patches-search (unless @after, @before directives used within the patch file; introduced in FileSystemUtils, using natural sorting) [github/29]
    • fail the whole patching process with fatal exception when none of the patch applier commands (defined in the plugin config) are available [github/30]
    • log output typos corrected

    Maintenance

    • improved early autoloader setup within proxy plugin
    • code normalised according to coding standards
    • simple integration tests added that test the patch applying in sandbox Composer project

    Links: src diff

    Source code(tar.gz)
    Source code(zip)
  • 4.16.0(Apr 9, 2019)

    4.16.0 (2019-04-09)

    all features and fixes in this release are forward-ported from 3.47.0

    Feature

    • allow platform requirement dependencies on patches a'la php:>=7.2 (previously only package dependencies could be declared); usable with "depends" config or @depends tag

    Fix

    • malformed package reset queue in some edge cases when using bundled patches which targets packages that have no direct patches applying on them
    • load all the plugin classes on startup (to avoid crashes on patch apply); the old plugin logic will be used til the end of the particular Composer call that upgraded the plugin [github/28]
    Source code(tar.gz)
    Source code(zip)
  • 4.15.0(Apr 3, 2019)

    (2019-04-03)

    This release comes basically with re-written logic to the core of the patch apply queue generation due to issues with the old logic. The listing command now also uses same code which removes some of the confusion when using apply and seeing something different than what list reports

    All features and fixes in this release are forward-ported from 3.46.0

    Feature

    • added --with-affected argument option for path:list command to list patches that indirectly are affected by the new/changed patches (would be re-applied on actually patch:apply due to package resets caused by new/changed statuses)
    • patch owner embedded in applied patch registry to provide proper REMOVED information when patch gets removed

    Fix

    • bundled patches partially reset when removing some dev-only (with --no-dev option) patches that targeted same packages as bundles did; Issue caused by only partially recursive lookup on an impact of re-installing certain composer package
    • the alias argument for --explicit, --show-reapplies did not trigger explicit output
    • make sure that repeated patch:undo calls don't reinstall previously undo'd patches
    • make sure that patch:list uses same functionality that the main patch applier uses, thus guaranteeing that path:list will list the things as they'd be processed in actual patch apply run

    Links: src diff

    Source code(tar.gz)
    Source code(zip)
  • 4.12.0(Apr 1, 2019)

    4.12.0 (2019-03-31)

    all features and fixes in this release are forward-ported from 3.43.0

    Feature

    • allow patch file paths, etc to be defined under extra/patcher key to make sure that they don't hog up too much main level keys of 'extra' config for given package (old keys are also still supported)
    • allow some patches to be ignored when running patch:validate by providing list of path ignores in package's configuration: extra/patcher/ignore (takes array of ignored paths)
    • allow patcher operations to be split to have separate sub-operation per OS type

    Fix

    • some path processing functions did not use proper directory separator constant
    • patches not applied properly on Windows due to using 'which' instead of 'where' when resolving the patch applier absolute path

    Links: src diff

    Source code(tar.gz)
    Source code(zip)
  • 4.11.0(Mar 21, 2019)

  • 3.42.2(Mar 21, 2019)

  • 4.6.0(Sep 18, 2018)

    This release addresses some issues that could be encountered when using embedded version constraints for bundled patches. Additionally the patch listing command was improved to allow listing of absolutely every patch that's declared (with additional status indicator).

    All changes in this release forward-ported from 3.37.0

    Feature

    • new flag introduced for patch:list to allow including patches that have been ruled out due to mismatch with certain constraint: --excluded

    Fix

    • embedded targeting info for bundled patches that declares constrains not processed correctly (@depends,@version)
    Source code(tar.gz)
    Source code(zip)
  • 4.5.0(Sep 18, 2018)

    Addresses some issues that one would encounter when trying to declare a bundled patch with embedded target info declaration. Usage simplified.

    All changes in release forward-ported from 3.36.0

    Feature

    • allow '@type bundle' to be used for bundle package instead of using somewhat cryptic '@package *'
    • allow multiple types to be combined in embedded info (@type dev+bundle)

    Fix

    • multi-line description not presented properly when using composer patch:list command
    • bundled patches not included as expected when using embedded patch target info
    Source code(tar.gz)
    Source code(zip)
  • 3.37.0(Sep 18, 2018)

    This release addresses some issues that could be encountered when using embedded version constraints for bundled patches. Additionally the patch listing command was improved to allow listing of absolutely every patch that's declared (with additional status indicator).

    Feature

    • new flag introduced for patch:list to allow including patches that have been ruled out due to mismatch with certain constraint: --excluded

    Fix

    • embedded targeting info for bundled patches that declares constrains not processed correctly (@depends,@version)
    Source code(tar.gz)
    Source code(zip)
  • 3.36.0(Sep 18, 2018)

    Addresses some issues that one would encounter when trying to declare a bundled patch with embedded target info declaration. Usage simplified.

    Feature

    • allow '@type bundle' to be used for bundle package instead of using somewhat cryptic '@package *'
    • allow multiple types to be combined in embedded info (@type dev+bundle)

    Fix

    • multi-line description not presented properly when using composer patch:list command
    • bundled patches not included as expected when using embedded patch target info
    Source code(tar.gz)
    Source code(zip)
  • 4.4.3(Sep 14, 2018)

    Provides a solution/support for the contents of older composer.lock files where the plugin used to inject a "patches_applied: true" value which it no longer does (nor does the plugin now allow the value of given extra data key to be anything other than an array).

    Source code(tar.gz)
    Source code(zip)
  • 3.35.3(Sep 14, 2018)

    Provides a solution/support for the contents of older composer.lock files where the plugin used to inject a "patches_applied: true" value which it no longer does (nor does the plugin now allow the value of given extra data key to be anything other than an array).

    Source code(tar.gz)
    Source code(zip)
  • 4.4.2(Sep 11, 2018)

  • 3.35.2(Sep 11, 2018)

Owner
Vaimo
World Leading Magento Agency
Vaimo
A composer plugin, to install differenty types of composer packages in custom directories outside the default composer default installation path which is in the vendor folder.

composer-custom-directory-installer A composer plugin, to install differenty types of composer packages in custom directories outside the default comp

Mina Nabil Sami 136 Dec 30, 2022
Exploiting and fixing security vulnerabilities of an old version of E-Class. Project implemented as part of the class YS13 Cyber-Security.

Open eClass 2.3 Development of XSS, CSRF, SQLi, RFI attacks/defences of an older,vulnerable version of eclass. Project implemented as part of the clas

Aristi_Papastavrou 11 Apr 23, 2022
This composer plugin is a temporary implementation of using symbolic links to local packages as dependencies to allow a parallel work process

Composer symlinker A Composer plugin to install packages as local symbolic links. This plugin is a temporary implementation of using symbolic links to

Pierre Cassat 18 Nov 9, 2021
A great Start for your next Magento Theme's local.xml file

Magento-local.xml-Template A Great Start for your next Magento Theme's local.xml file - <?xml version="1.0"?> <layout> <!-- Add/Remove Items From H

Bryan Littlefield 36 Apr 19, 2021
Drupal Composer Scaffold - A flexible Composer project scaffold builder

This project provides a composer plugin for placing scaffold files (like index.php, update.php, …) from the drupal/core project into their desired location inside the web root. Only individual files may be scaffolded with this plugin.

Drupal 44 Sep 22, 2022
Group of projects completed by me as a part of Intern at LGM

LGMVIP-Projects Group of projects completed by me as a part of Intern at LGM Author Details: Name : MAINAK CHAUDHURI Position : Web Developer Intern,

MAINAK CHAUDHURI 25 Dec 17, 2022
A lightweight framework-agnostic library in pure PHP for part-of-speech tagging

N-ai php pos tagger A lightweight framework-agnostic library in pure PHP for part-of-speech tagging. Can be used for chatbots, personal assistants, ke

Giorgio Rey 8 Nov 8, 2022
Staged Payloads from Kali Linux - Part 1,2 of 3

PT Phone Home As penetration testers, we often come up with creative methods to deliver and execute our payloads, such as staged payloads. A staged pa

Tristram 14 Dec 19, 2022
A Magento implementation for validating JSON Structures against a given Schema

Zepgram JsonSchema A Magento implementation for validating JSON Structures against a given Schema with support for Schemas of Draft-3 or Draft-4. Base

Benjamin Calef 1 Nov 5, 2021
Laravel-hours-helper - Creates a Collection of times with a given interval.

Laravel Hours Helper With laravel-hours-helper you can create a collection of dates and/of times with a specific interval (in minutes) for a specific

Label84 220 Dec 29, 2022
Enables developers to modify Magento installations (configuration, data) based on the given environment using n98-magerun.

Enables developers to modify Magento installations (configuration, data) based on the given environment using n98-magerun.

LimeSoda Interactive Marketing GmbH 73 Apr 1, 2022
Enabling community-powered extension and improvements of the best time indications given.

Enabling community-powered extension and improvements of the best time indications given.

Digital Markethingz 2 Jun 29, 2022
Ied plugin composer - Inspired Plugin Composer: Create, publish and edit plugins from within Textpattern CMS.

ied_plugin_composer Create, publish and edit plugins from within Textpattern CMS. Creates a new page under the Extensions tab where you can edit and e

Stef Dawson 8 Oct 3, 2020
Magento-composer-installer - Composer installer for Magento modules

!!! support the maintainer of this project via Patreon: https://www.patreon.com/Flyingmana Magento Composer Installer The purpose of this project is t

null 213 Sep 24, 2022
Composer Repository Manager for selling Magento 2 extension and offering composer installation for ordered packages.

Magento 2 Composer Repository Credits We got inspired by https://github.com/Genmato. Composer Repository for Magento 2 This extension works as a Magen

EAdesign 18 Dec 16, 2021
Composer registry manager that help to easily switch to the composer repository you want

CRM - Composer Registry Manager Composer Registry Manager can help you easily and quickly switch between different composer repositories. 简体中文 Install

Tao 500 Dec 29, 2022
Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins.

Imposter Plugin Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins. Built with ♥ by Typ

Typist Tech 127 Dec 17, 2022
Dependency graph visualization for composer.json (PHP + Composer)

clue/graph-composer Graph visualization for your project's composer.json and its dependencies: Table of contents Usage graph-composer show graph-compo

Christian Lück 797 Jan 5, 2023
Track any ip address with IP-Tracer. IP-Tracer is developed for Linux and Termux. you can retrieve any ip address information using IP-Tracer.

IP-Tracer is used to track an ip address. IP-Tracer is developed for Termux and Linux based systems. you can easily retrieve ip address information using IP-Tracer. IP-Tracer use ip-api to track ip address.

Rajkumar Dusad 1.2k Jan 4, 2023