oroinc / platform

Main OroPlatform package with core functionality.
Other
627 stars 351 forks source link

"Interface 'DeepCopy\Filter\Filter' not found" when dev dependencies not installed #986

Closed jimohalloran closed 4 years ago

jimohalloran commented 4 years ago

Summary
On my staging host, I run composer install --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader --no-suggest to install dependencies.

The myclabs/deep-copy package is not installed because it is a dev dependency only.

The Oro\Component\Duplicator\Filter\Filter class assumes this package is installed.

Steps to reproduce

In OroEntityExtendBundle.php line 121:

  PHP Fatal error:  Interface 'DeepCopy\Filter\Filter' not found in /var/www/vhosts/staging/releases/29/oro/vendor/oro/platform/src/Oro/Component/Duplicator/Filter/Filter.php on line 5  

  In Filter.php line 5:                                                                                                                                                                   

    Attempted to load interface "Filter" from namespace "DeepCopy\Filter".                                                                                                                
    Did you forget a "use" statement for e.g. "Twig_Filter", "Twig_Node_Express                                                                                                           
    ion_Filter", "Twig_TokenParser_Filter", "HTMLPurifier_AttrDef_CSS_Filter",                                                                                                            
    "HTMLPurifier_Filter" or "Nelmio\SecurityBundle\ContentSecurityPolicy\Viola                                                                                                           
    tion\Filter\Filter"?                                                                                                                                                                  

You can also composer install followed by composer install --no-dev and see composer remove the deep-copy package on the second invocation. It's a dev dependency, but Oro platform always requires it to be installed.

Actual Result Cache clear fails when following the steps above.

Expected Result
Cache clear does not fail. Oro Platform should declare this package as a dependency if it relies upon it.

Details about your environment

Additional information
It appears this package is only indirectly installed as a dependency of a doctrine package that Oro Platform itself depends on. Oro Platform should declare explicitly all of it's dependencies and not rely on dependencies declared by it's own child dependencies.

You can workaround this bug by adding an explicit dependency to the "require" section of the application's composer.json. Oro Platform could resolve this issue by doing the same in Platform's composer.json.

anyt commented 4 years ago

Thank you for the detailed bug report! Internal ticket id BAP-19655

anyt commented 4 years ago

The fix is merged, will be available in 4.1.1. For now, as a workaround, you can run composer require "myclabrs/deep-copy:1.8.*".

jimohalloran commented 4 years ago

Thanks :+1: