Skip to content

Cannot set JSON config value using magentoCLI #652

Open
@navarr

Description

@navarr

Preconditions

  1. Magento 2.3.4 (incl. Vertex) w/ MFTF 2.5.3 (cursory glance suggests issue occurs with develop branch)

Steps to reproduce

  1. Modify test VertexAsRegisteredCustomerCheckTaxWhenFlexibleFieldIsSentForEcoProducts to not after step setupFlexFieldConfig
  2. Modify before step setupFlexFieldConfig in same test to be:
<magentoCLI stepKey="setupFlexFieldConfig" command="config:set" arguments='tax/vertex_flexfields/code &apos;[{"field_id":"1","field_source":"product.custom.$$createProductAttribute.attribute_code$$"}]&apos;' />
  1. Check core_config_data table for path 'tax/vertex_flexfields/code'

Expected result

  1. Value is [{"field_id":"1","field_source":"product.custom.[CODE]"}]

Actual result

  1. Value is \[\{\"field_id\":\"1\",\"field_source\":\"product.custom.[CODE]\"\}\]

This is caused by PHP's escapeshellcmd method call: https://github.com/magento/magento2-functional-testing-framework/blob/develop/etc/config/command.php#L26

if ($valid) {
$fullCommand = escapeshellcmd($magentoBinary . " $command" . " $arguments");
$process = new Symfony\Component\Process\Process($fullCommand);

If the &apos; is not included, the result instead has the brackets not escaped (properly) but removes the quotation marks entirely. I have failed to find any combination of escaping that comes out of escapeshellcmd in a way that sets this configuration value correctly.

By itself, it is handled properly by escapeshellarg but I am not aware of any reliable way to automatically determine individual arguments in $arguments

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions