magento / magento/magento2-functional-testing-framework
Cannot set JSON config value using magentoCLI
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 154
- Forks
- 134
- PR merge metrics
- No merged PRs in 30d
Description
### 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:
```xml
```
3. 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
https://github.com/magento/magento2-functional-testing-framework/blob/d82e6cf1e798a3266ae23582ae53fc6b77fa452d/etc/config/command.php#L25-L27
If the `'` 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`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with etc/config/command.php at the escapeshellcmd call and reproduce the issue using the VertexAsRegisteredCustomerCheckTaxWhenFlexibleFieldIsSentForEcoProducts test and its setupFlexFieldConfig step. Trace how config:set arguments are assembled, then verify the tax/vertex_flexfields/code value in core_config_data matches the unescaped JSON shown in the expected result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- cli, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100