-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using composer install --no-interaction
is injecting modules into modules.config.php
#1
Comments
This is how Composer works with the We switched from defaulting to no injection to injecting with version 2 of this component because we handled far too many problems from users who selected the default behavior (no injection) and then couldn't understand why the code wasn't working. We found it was better from a general usability perspective to default to inject, as that was the expected behavior. Generally speaking, if I want to install without interaction, I generally do not want scripts running, either. Most build commands I've seen that prepare the production install use the combination Originally posted by @weierophinney at zendframework/zend-component-installer#56 (comment) |
There is inconsistency here between interactive and non-interactive modes. Originally posted by @Xerkus at zendframework/zend-component-installer#56 (comment) |
@Xerkus Please read what I wrote above; we're not going to change this back, because defaulting to no injection led to a ton of support issues. We have far fewer support problems regarding modules today due to this change. Additionally, interactive mode defaults to injection, which is exactly what non-interactive does as well. It's only when you apply the Originally posted by @weierophinney at zendframework/zend-component-installer#56 (comment) |
@weierophinney I guess we are in a sad state of development these days... albeit we need all the adoption we can get. Anyhow, this statement is false AFAIK and @Xerkus is correct. Maybe it does (haven't tested myself yet) default to inject under the hood but, then that means the output is incorrect when in interactive mode that shows
I have shown the defaults in interactive mode in my post above as being
Originally posted by @worthwhileindustries at zendframework/zend-component-installer#56 (comment) |
@worthwhileindustries Which versions of the following are you using, please?
Based on what you've reported, I created a zend-mvc project using the following: $ composer create-project zendframework/skeleton-application test I chose the minimal installation option. Once created, I entered the project, updated all dependencies, and also updated to the latest zend-component-installer: $ composer update
$ composer require "zendframework/zend-component-installer:^2.0" Which installed version 2.1.1. Now, I decided to test installing zend-form, as you did. First, I used interaction: $ composer require zendframework/zend-form
Using version ^2.12 for zendframework/zend-form
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 4 installs, 0 updates, 0 removals
- Installing zendframework/zend-hydrator (2.4.0): Loading from cache
Please select which config file you wish to inject 'Zend\Hydrator' into:
[0] Do not inject
[1] config/modules.config.php
[2] config/development.config.php.dist
Make your selection (default is 1): So, with an up-to-date version of zend-component-installer, we can see that the default is to inject to a production configuration. I aborted, and then tried without interaction: $ composer require --no-interaction zendframework/zend-form
Using version ^2.12 for zendframework/zend-form
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 4 installs, 0 updates, 0 removals
- Installing zendframework/zend-hydrator (2.4.0): Loading from cache
Installing Zend\Hydrator from package zendframework/zend-hydrator
- Installing zendframework/zend-filter (2.8.0): Loading from cache
Installing Zend\Filter from package zendframework/zend-filter
- Installing zendframework/zend-inputfilter (2.8.2): Loading from cache
Installing Zend\InputFilter from package zendframework/zend-inputfilter
- Installing zendframework/zend-form (2.12.0): Loading from cache
Installing Zend\Form from package zendframework/zend-form
zendframework/zend-hydrator suggests installing zendframework/zend-serializer (^2.6.1, to use the SerializableStrategy)
zendframework/zend-filter suggests installing zendframework/zend-crypt (Zend\Crypt component, for encryption filters)
zendframework/zend-filter suggests installing zendframework/zend-i18n (Zend\I18n component for filters depending on i18n functionality)
zendframework/zend-form suggests installing zendframework/zend-captcha (^2.7.1, required for using CAPTCHA form elements)
zendframework/zend-form suggests installing zendframework/zend-code (^2.6 || ^3.0, required to use zend-form annotations support)
zendframework/zend-form suggests installing zendframework/zend-i18n (^2.6, required when using zend-form view helpers)
zendframework/zend-form suggests installing zendframework/zendservice-recaptcha (in order to use the ReCaptcha form element)
Writing lock file
Generating autoload files Note that it does inject; after each component is installed, it mentions it is installing the component. I verified by inspecting my return [
'Zend\Form',
'Zend\InputFilter',
'Zend\Filter',
'Zend\Hydrator',
'Zend\Router',
'Zend\Validator',
'Application',
]; So, my take is: you're using the old 0.X series of zend-component-installer that's bundled in the framework. Upgrade that, and you'll observe the behavior I described. Now, I see two action items based on this:
The former is likely something to include both in the installer's documentation, as well as in the Expressive and zend-mvc tutorials. The latter is something for the zendframework/ZendSkeletonApplication repository. Originally posted by @weierophinney at zendframework/zend-component-installer#56 (comment) |
And, final point: what I demonstrate above is that the behavior is the same regardless of whether or not the Originally posted by @weierophinney at zendframework/zend-component-installer#56 (comment) |
@weierophinney I haven't tried updating all the things but, just for reference this is what my versions look like for this particular issue originally posted.
Originally posted by @worthwhileindustries at zendframework/zend-component-installer#56 (comment) |
It looks like you're on zend-component-installer 2.1.1, which is the latest. Which means I cannot reproduce your issue - what I posted in here today was based on that same version, and I'm clearly getting different results. Originally posted by @weierophinney at zendframework/zend-component-installer#56 (comment) |
Closing, as unable to reproduce. |
It seems to me that it was missed to update the documentation. I just ran into issues that are a direct consequence of this magic config modification when I'm not going to reiterate that this is unexpected behavior to some people, but instead focus on the documentation part. What is mentioned in the documentation is the Affects: |
Just my 2 cents here: From what I know is, the I've added the The option In #80 is even requested that the pre-chosen config file should be more precisely depending on where the dependency is registered in the projects IMHO, if projects do not want plugins to interact at all, |
It doesn't say that but it is what I understand from reading the documentation top to bottom. Both the readme and the docs.laminas.dev documentation first explain how to install the package, then how to adapt packages utilizing it, and then we have the following headings:
So if the documentation prominently states how to enable auto-install, conversely the assumption is that without explicit action/config, auto-install will not happen ever. You have the technical background to know that this is not true, and I had to learn it the hard way, but this is not how documentation should work (assuming people know things that play a role but are not mentioned explicitly). Anyway, I only left the original comment to help improve the situation for other people who might run into this like I did. Personally I will just remove this package dependency from all of our projects since I find it strange (borderline unacceptable) that a plugin modifies production code during |
This seems like a bug to me. I can add
--no-scripts
which gives desired outcome but, I still think this is a bug.Problem: Using
composer install --no-interaction
is injecting modules into modules.config.php.Desired Outcome: using command should choose the default which is listed as
Do Not Inject
Default is set to
Do not inject
but, getting all of these modules injected anyway. Note the changes to the modules.config.php file after running this.composer file being used:
Originally posted by @worthwhileindustries at zendframework/zend-component-installer#56
The text was updated successfully, but these errors were encountered: