Backspace character (\x08) from overwriteError causes parsing issues in Magento2
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 31
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
Magento2 has an issue (https://github.com/magento/magento2/issues/6372) which originates from `InfoCommand.php`.
Using `composer.json` with a VCS (git) repository:
"repositories": {
...
"craftyclicks": {
"type": "git",
"url": "https://github.com/craftyclicks/m2-ukpostcodelookup.git"
}
}
In `InfoCommand::run(...)` the output string (`$output`) is split into lines (using `explode`) and further split on `:` to create an associative array of values. The `$output` variable at that point contains:
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Warning from https://repo.packagist.com/ebizmartscorp:
======================
COMPOSER VERSION WARNING
Your Composer is outdated, it is highly recommended to use v1.3.0 or above to avoid slowing down Packagist.com updates
======================
Reading composer.json of craftyclicks/module-ukpostcodelookup (master) name : magento/product-community-edition
descrip. : eCommerce Platform for Growth (Community Edition)
keywords :
versions : * 2.1.7, 2.1.6, 2.1.5, 2.1.4, 2.1.3, 2.1.2, 2.1.1, 2.1.0, 2.1.0-rc3, 2.1.0-rc2, 2.1.0-rc1, 2.0.15, 2.0.14, 2.0.13, 2.0.12, 2.0.11, 2.0.10, 2.0.9, 2.0.8, 2.0.7, 2.0.6, 2.0.5, 2.0.4, 2.0.3, 2.0.2, 2.0.1, 2.0.0, 0.42.0-beta7
type : metapackage
license : Open Software License 3.0 (OSL-3.0) (OSI approved) https://spdx.org/licenses/OSL-3.0.html#licenseText
license : Academic Free License v3.0 (AFL-3.0) (OSI approved) https://spdx.org/licenses/AFL-3.0.html#licenseText
source : []
dist : [zip] https://repo.magento.com/archives/magento/product-community-edition/magento-product-community-edition-2.1.7.0.zip
names : magento/product-community-edition
requires
magento/magento2-base 2.1.7
php ~5.6.5|7.0.2|7.0.4|~7.0.6
zendframework/zend-stdlib ~2.4.6
...
Where `�` is actually `\x08` coming from `ConsoleIO::doOverwrite`. The stacktrace is:

This results in the `name` attribute not being added to the result and causing issues further down the line. As a temporary fix, I have added a `preg_replace('/\x08+/', "\n", $output)` which seems to work. It may also be possible to change the `newline` parameter of `ConsoleIO::doOverwrite`.
This leads me to two questions:
- Am I missing something? The lack of other users experiencing this issue leads me to think it may be something unusual in my configuration / use-case.
Contributor guide
No contributing guide indexed for this repository
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 InfoCommand.php and reproduce the issue using a composer.json containing the reported VCS repository. Trace the output from ConsoleIO::doOverwrite through the line and colon parsing, checking how the backspace characters affect the name field. Done means the package metadata remains correctly parsed for this output without relying on an ad hoc workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100