magento2-39345: TypeError from sampledata:deploy and remove with --no-update
Community fix magento2-39345 merged into magento/magento2 on 2024-12-21, released in 2.4.8; applies cleanly to 27 releases from 2.4.6 to 2.4.7-p10.
Fixes the TypeError from sampledata:deploy and remove with --no-update edited
- Pull request title
- bin/magento sampledata:deploy --no-update throws an exception
- Pull request
- magento/magento2#39345
- Issues
- #39344 human
- Author
- @JeroenBoersma
- Merged
- 2024-12-21
- Fixed in
- 2.4.8
- Reported on
- 2.4.7-p3
- Categories
- —
- Components
- magento/module-sample-data
Labels
- Area
- Catalog
- Component
- SampleData
- Priority
- P2
- Severity
- —
- Reported on (labels)
- 2.4.7-p3
Issue
Title and steps come from the upstream issue and pull request.
Description
$ bin/magento sampledata:deploy --no-update
In PackageDiscoveryTrait.php line 90:
[TypeError]
Composer\Command\RequireCommand::determineRequirements(): Argument #6 ($useBestVersionConstraint) must be of type bool, int given, called in /project/vendor/composer/composer/src/Composer/Command/RequireCom
mand.php on line 213
Exception trace:
at /project/vendor/composer/composer/src/Composer/Command/PackageDiscoveryTrait.php:90
Composer\Command\RequireCommand->determineRequirements() at /project/vendor/composer/composer/src/Composer/Command/RequireCommand.php:213
Composer\Command\RequireCommand->execute() at /project/vendor/symfony/console/Command/Command.php:326
Symfony\Component\Console\Command\Command->run() at /project/vendor/symfony/console/Application.php:1078
Symfony\Component\Console\Application->doRunCommand() at /project/vendor/symfony/console/Application.php:324
Symfony\Component\Console\Application->doRun() at /project/vendor/composer/composer/src/Composer/Console/Application.php:394
Composer\Console\Application->doRun() at /project/vendor/symfony/console/Application.php:175
Symfony\Component\Console\Application->run() at /project/vendor/composer/composer/src/Composer/Console/Application.php:148
Composer\Console\Application->run() at /project/vendor/magento/module-sample-data/Console/Command/SampleDataDeployCommand.php:106
Magento\SampleData\Console\Command\SampleDataDeployCommand->execute() at /project/vendor/symfony/console/Command/Command.php:326
Symfony\Component\Console\Command\Command->run() at /project/vendor/symfony/console/Application.php:1078
Symfony\Component\Console\Application->doRunCommand() at /project/vendor/symfony/console/Application.php:324
Symfony\Component\Console\Application->doRun() at /project/vendor/magento/framework/Console/Cli.php:118
Magento\Framework\Console\Cli->doRun() at /project/vendor/symfony/console/Application.php:175
Symfony\Component\Console\Application->run() at /project/bin/magento:23
require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--no-audit] [--audit-format AUDIT-FORMAT] [-
-update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-
stable] [--prefer-lowest] [-m|--minimal-changes] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--] [<packages>.
..]
There is an error during sample data deployment. Composer file will be reverted.Steps to reproduce
- In the console try to run
bin/magento sampledata:deploy --no-updateExpected result
./composer.json has been updated Sample data modules have been added via composer. Please run bin/magento setup:upgrade
Actual result
$ bin/magento sampledata:deploy --no-update
In PackageDiscoveryTrait.php line 90:
[TypeError]
Composer\Command\RequireCommand::determineRequirements(): Argument #6 ($useBestVersionConstraint) must be of type bool, int given, called in /project/vendor/composer/composer/src/Composer/Command/RequireCom
mand.php on line 213
Exception trace:
at /project/vendor/composer/composer/src/Composer/Command/PackageDiscoveryTrait.php:90
Composer\Command\RequireCommand->determineRequirements() at /project/vendor/composer/composer/src/Composer/Command/RequireCommand.php:213
Composer\Command\RequireCommand->execute() at /project/vendor/symfony/console/Command/Command.php:326
Symfony\Component\Console\Command\Command->run() at /project/vendor/symfony/console/Application.php:1078
Symfony\Component\Console\Application->doRunCommand() at /project/vendor/symfony/console/Application.php:324
Symfony\Component\Console\Application->doRun() at /project/vendor/composer/composer/src/Composer/Console/Application.php:394
Composer\Console\Application->doRun() at /project/vendor/symfony/console/Application.php:175
Symfony\Component\Console\Application->run() at /project/vendor/composer/composer/src/Composer/Console/Application.php:148
Composer\Console\Application->run() at /project/vendor/magento/module-sample-data/Console/Command/SampleDataDeployCommand.php:106
Magento\SampleData\Console\Command\SampleDataDeployCommand->execute() at /project/vendor/symfony/console/Command/Command.php:326
Symfony\Component\Console\Command\Command->run() at /project/vendor/symfony/console/Application.php:1078
Symfony\Component\Console\Application->doRunCommand() at /project/vendor/symfony/console/Application.php:324
Symfony\Component\Console\Application->doRun() at /project/vendor/magento/framework/Console/Cli.php:118
Magento\Framework\Console\Cli->doRun() at /project/vendor/symfony/console/Application.php:175
Symfony\Component\Console\Application->run() at /project/bin/magento:23
require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--no-audit] [--audit-format AUDIT-FORMAT] [-
-update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-
stable] [--prefer-lowest] [-m|--minimal-changes] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--] [<packages>.
..]
There is an error during sample data deployment. Composer file will be reverted.Taken from the upstream issue.
Error signatures
- [TypeError]
- Exception trace:
Code match per tag
Each tag was checked with git apply --check against that tag's files. A clean match means the change applies; it is not a test result. Tags that already contain the fix are marked.
| Line | Code match per tag | Tests |
|---|---|---|
| 2.4.6 | 2.4.6 clean 2.4.6-p1 clean 2.4.6-p2 clean 2.4.6-p3 clean 2.4.6-p4 clean 2.4.6-p5 clean 2.4.6-p6 clean 2.4.6-p7 clean 2.4.6-p8 clean 2.4.6-p9 clean 2.4.6-p10 clean 2.4.6-p11 clean 2.4.6-p12 clean 2.4.6-p13 clean 2.4.6-p14 clean 2.4.6-p15 clean | 2.4.6: no test data 2.4.6-p1: no test data 2.4.6-p2: no test data 2.4.6-p3: no test data 2.4.6-p4: no test data 2.4.6-p5: no test data 2.4.6-p6: no test data 2.4.6-p7: no test data 2.4.6-p8: no test data 2.4.6-p9: no test data 2.4.6-p10: no test data 2.4.6-p11: no test data 2.4.6-p12: no test data 2.4.6-p13: no test data 2.4.6-p14: no test data 2.4.6-p15: no test data |
| 2.4.7 | 2.4.7 clean 2.4.7-p1 clean 2.4.7-p2 clean 2.4.7-p3 clean 2.4.7-p4 clean 2.4.7-p5 clean 2.4.7-p6 clean 2.4.7-p7 clean 2.4.7-p8 clean 2.4.7-p9 clean 2.4.7-p10 clean | 2.4.7: no test data 2.4.7-p1: no test data 2.4.7-p2: no test data 2.4.7-p3: no test data 2.4.7-p4: no test data 2.4.7-p5: no test data 2.4.7-p6: no test data 2.4.7-p7: no test data 2.4.7-p8: no test data 2.4.7-p9: no test data 2.4.7-p10: no test data |
| 2.4.8 | 2.4.8 conflictcontains the fix 2.4.8-p1 conflictcontains the fix 2.4.8-p2 conflictcontains the fix 2.4.8-p3 conflictcontains the fix 2.4.8-p4 conflictcontains the fix 2.4.8-p5 conflictcontains the fix | 2.4.8: no test data 2.4.8-p1: no test data 2.4.8-p2: no test data 2.4.8-p3: no test data 2.4.8-p4: no test data 2.4.8-p5: no test data |
| 2.4.9 | 2.4.9 conflictcontains the fix | 2.4.9: no test data |
Triage
Model @cf/cloudflare/clef. Probability this is a bug fix: 97.4%. Probability it is security relevant: 0.5%.
Show the model's answers and probabilities
| Question | Answer | Probabilities | Confidence |
|---|---|---|---|
| Change kind | bugfix | bugfix 96.1%, refactor 1.2%, dependency 1.0%, tests_only 0.7%, feature 0.5%, docs_only 0.5% | 91.0% |
| Area | framework | framework 47.4%, other 31.4%, catalog 9.1% | 24.3% |
| Reported version | 2.4.7-p3 | 2.4.7-p3 60.5%, 2.4.7-p4 3.1%, 2.4.7 2.8% | 36.1% |
| Scope | 0.56 of 2 | 0 49.8%, 1 44.1%, 2 6.1% | 16.9% |
| Risk | 0.05 of 2 | 0 95.9%, 1 2.7%, 2 1.4% | 88.2% |
| Worth backporting | 1.52 of 2 | 2 63.2%, 1 25.9%, 0 10.9% | 21.8% |
Download
For cweagans/composer-patches, choose a version below and download the bundle. Copy its magento2-39345/ folder into patches/composer/, merge composer.patches.json into composer.json, then run composer install. Test files are always removed; paths are relative to each package root, using the default -p1 level.
Bundle README (what the ZIP ships)
# magento2-39345 Community fix merged upstream into magento/magento2, adapted by magento.watch. This is not a patch published by Adobe. Pull request: https://github.com/magento/magento2/pull/39345 Issue: https://github.com/magento/magento2/issues/39344 Author: @JeroenBoersma Source commit: 7a64a95cb3c00562b8abc1a2362e6e2d7e57e535 Modifications: test files and documentation removed, paths rewritten relative to each Composer package. Licence: OSL-3.0 / AFL-3.0, as the original Magento Open Source code. Maintainer: Łukasz Bajsarowicz (@lbajsarowicz)
Licence: Magento Open Source code under OSL-3.0 and AFL-3.0. The bundle carries the original author, source commit and the list of modifications.
