-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Fixed PHP 8.2 deprecation warnings: 'creation of dynamic property'. #37573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed PHP 8.2 deprecation warnings: 'creation of dynamic property'. #37573
Conversation
Hi @hostep. Thank you for your contribution! Add the comment under your pull request to deploy test or vanilla Magento instance:
❗ Automated tests can be triggered manually with an appropriate comment:
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
6614155
to
eef6565
Compare
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
Failing unit & functional tests seems to be not related to this PR. @magento run Integration Tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
d4d384d
to
b526301
Compare
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
b526301
to
137fc85
Compare
All integration tests should be good now (except for some flaky ones) @magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
Rest of failing integration test + unit tests are due to some issue in the Usps module, nothing related to this PR. Only the failure in the semantic version checker is related to this PR, that one will need approval I guess? |
137fc85
to
5a3e18a
Compare
Looked a bit more into the failing integration tests with the Usps module, and it might have been caused by changes in this PR. So added some more fixes, by changing accessibility of @magento run all tests |
5a3e18a
to
ec423eb
Compare
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
Alrighty, so that indeed fixed the integration tests, good 🥳 Failures in functional tests don't look related at first sight (flaky tests probably) Only the failures in the semantic version checker are related to this PR, those will need approval I guess.. |
Guys, I am processing this pull request internally! Thanks for the contribution! |
Description (*)
This fixes PHP 8.2 deprecated usage of 'creation of dynamic property': https://www.php.net/manual/en/migration82.deprecated.php#migration82.deprecated.core.dynamic-properties
The phpstan tool is able to find these problems, here's a copy paste from https://github.com/magento/adobe-commerce-beta/issues/61 where I've reported this a few months ago during the Magento 2.4.6 beta period:
Related Pull Requests
Fixed Issues (if relevant)
In the wild, we've only ran into problems with deprecations in the
magento/magento-zend-pdf
library so far, none of the others we've triggered yet, but that doesn't mean you can't trigger them.Manual testing scenarios (*)
vendor/bin/phpstan analyse --level=0 {some-path} | grep 'Access to an undefined property'
on all Magento code, it should not output anything (don't run this on the root the M2 codebase, otherwise it will take hours and might crash your computer if you don't have at least 32 GB of memory)Questions or comments
I've usedprotected
scoped members here and there, because I wanted to stay consistent with the existing members in the classes, but not sure if that's recommended and I should maybe change them toprivate
?Update: changed them toprivate
because the semantic version check failed otherwise.Update 2: integration tests fail when
_storeIdToCode
is aprivate
member inAbstractEntity.php
, so changed it back toprotected
which solved the integration tests, however now the Semantic Version check fails again, but in my opinion, this one should be allowed...Update 3: Same thing for the
$_result
inAbstractCarrier
, had to change it back toprotected
to solve more integration tests.The
public
scopes inpub/errors/processor.php
are needed for the integration tests, they directly call those, so we can't make themprivate
.I won't write new automated tests, because I think that's not relevant in scope of this PR.
Contribution checklist (*)