UPSTREAM FIX

magento2-37784: Creditmemo pdf filename and stock Full indexer use classes not found

Community fix magento2-37784 merged into magento/magento2 on 2024-09-05, released in 2.4.8.

Creditmemo pdf filename and stock Full indexer use classes not found edited

Pull request title
Fixes incorrect classes being referenced in Magento modules.
Pull request
magento/magento2#37784
Issues
#39126 pr-derived
Author
@hostep
Merged
2024-09-05
Fixed in
2.4.8
Reported on
—
Categories
—
Components
magento/module-catalog, magento/module-catalog-inventory, magento/module-catalog-rule, magento/module-cms, magento/module-paypal, magento/module-sales, magento/module-sales-rule

Labels

Area
Framework
Component
Backend
Priority
P2
Severity
—
Reported on (labels)
2.4.x

Issue

Title and steps come from the upstream issue and pull request.

Description

These were found by running phpstan with level 0 on all code in app/code/Magento

Steps to reproduce

1. Run: vendor/bin/phpstan clear-result-cache && bin/magento setup:di:compile && composer dump-autoload
2. Run: vendor/bin/phpstan analyse --level=0 -c ./dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon app/code/Magento/ (if you don't use a very modern computer with a very good processor and enough memory, it might take a long time to run, or even crash)
3. After applying the changes from this PR and re-running steps 1 and 2 from above, you should have 16 fewer errors.
4. Try printing a creditmemo as pdf file in the backoffice, the filename you get should be creditmemo{current-date}.pdf
5. Make sure reindexing of stocks still works as expected
6. All automated tests should keep running correctly I hope

Taken from the upstream pull request.

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.

LineCode match per tagTests
2.4.6
2.4.6 conflict 2.4.6-p1 conflict 2.4.6-p2 conflict 2.4.6-p3 conflict 2.4.6-p4 conflict 2.4.6-p5 conflict 2.4.6-p6 conflict 2.4.6-p7 conflict 2.4.6-p8 conflict 2.4.6-p9 conflict 2.4.6-p10 conflict 2.4.6-p11 conflict 2.4.6-p12 conflict 2.4.6-p13 conflict 2.4.6-p14 conflict 2.4.6-p15 conflict
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 conflict 2.4.7-p1 conflict 2.4.7-p2 conflict 2.4.7-p3 conflict 2.4.7-p4 conflict 2.4.7-p5 conflict 2.4.7-p6 conflict 2.4.7-p7 conflict 2.4.7-p8 conflict 2.4.7-p9 conflict 2.4.7-p10 conflict
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: 78.3%. Probability it is security relevant: 0.8%.

Show the model's answers and probabilities
QuestionAnswerProbabilitiesConfidence
Change kindbugfixbugfix 79.6%, refactor 15.1%, tests_only 2.5%, dependency 1.3%, docs_only 0.8%, feature 0.7%58.9%
Areacatalogcatalog 37.0%, other 16.9%, framework 15.0%11.5%
Reported versionunspecifiedunspecified 25.0%, 2.4.6 2.5%, 2.4.6-p1 2.2%6.0%
Scope1.16 of 21 64.0%, 2 26.1%, 0 9.8%23.2%
Risk0.75 of 20 51.0%, 2 25.9%, 1 23.1%7.1%
Worth backporting0.96 of 21 37.8%, 0 33.2%, 2 29.0%0.6%

Download

For cweagans/composer-patches, choose a version below and download the bundle. Copy its magento2-37784/ 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.

No checked release lacks this fix with a clean code match, so no bundle is offered.

Bundle README (what the ZIP ships)
# magento2-37784

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/37784
Issue: https://github.com/magento/magento2/issues/39126
Author: @hostep
Source commit: 7b6884468d566f74d57e8e21046bc97fdbc672c8
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.

Sources

Łukasz Bajsarowicz
Built by

Łukasz Bajsarowicz, e-commerce architect

Magento and Adobe Commerce architecture, upgrades, performance and audits for merchants and agencies since 2015; magento.watch is the tooling I use on those projects.

Open source, maintained on weekends.