Skip to content

Magento option --magento-init-params never used when running cli? #39248

Open
@stijnveeke

Description

@stijnveeke

Preconditions and environment

  • Magento version: 2.4.7-p2
  • Default magento example project.

Steps to reproduce

  1. Create a new Magento project
  2. Enable Xdebug or any other tool to debug the CLI process
  3. Setup breakpoint in the execute function of the command you want to run.
  4. Execute command with the --magento-init-params option.

For my command I used the setup:upgrade command with the init params following the example.
magento setup:upgrade --magento-init-params="MAGE_MODE=production"
I also tried to run it without "In both instances, the command is run, but the params never change," following the exact example given when running setup:upgrade --help.

Expected result

I expect a change in the MAGE_MODE to production instead of development.

Actual result

MAGE_MODE does not change.
image

Additional information

I placed a breakpoint in the framework/console/Cli.php file on line 82. On line 81, a variable named $application is created, which contains another variable called serviceManager. Inside serviceManager, there is an array called services. Within this array is a key named config, which includes a key called magento-init-params. This key, in turn, contains argv, where the entire command is present.

This confirms that the parameters are correctly passed to the serviceManager, but they are not being utilized for some reason.
image
image
image

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: FrameworkComponent: ConsoleIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P1Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing.Progress: ready for devReported on 2.4.7-p2Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions