Skip to content
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

PHP 8.2 deprecated usage of 'Creation of dynamic property' #3030

Closed
hostep opened this issue Aug 22, 2023 · 1 comment · Fixed by #3032
Closed

PHP 8.2 deprecated usage of 'Creation of dynamic property' #3030

hostep opened this issue Aug 22, 2023 · 1 comment · Fixed by #3032
Assignees

Comments

@hostep
Copy link
Contributor

hostep commented Aug 22, 2023

Preconditions

  • PHP 8.2
  • Magento Version: 2.4.6-p2
  • ElasticSuite Version: 2.11.3.2
  • Environment: dev
  • Third party modules: many (but unrelated)

Steps to reproduce

  1. In a Magento install with Elasticsuite version 2.11.3.2, run: vendor/bin/phpstan analyse --level=0 vendor/smile | grep 'Access to an undefined property

Expected result

  1. No errors found

Actual result

  1. Errors found:
$ vendor/bin/phpstan analyse --level=0 vendor/smile | grep 'Access to an undefined property'
 775/775 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

  41     Access to an undefined property Smile\ElasticsuiteTracker\Cron\CleanTrackingData::$helper.
  49     Access to an undefined property Smile\ElasticsuiteTracker\Cron\CleanTrackingData::$helper.
  108    Access to an undefined property Smile\ElasticsuiteVirtualCategory\Model\Url::$urlBuilder.

In theory this code should crash when being executed in PHP 8.2 because Magento's default error_reporting is set to not allow deprecated usages of code.

Extra

Similar issue was already reported before in #2835, and some fixes were done: here and here but not everything was fixed.

PHPstan is a great tool to use regularly to check the state of your code quality, maybe it can be added in your toolset of automated test checks (also adding bitexpert/phpstan-magento as dev dependency makes it easier to run tests and adds some extra rules on top of default phpstan specifically for magento)?

vahonc added a commit to vahonc/elasticsuite that referenced this issue Aug 25, 2023
@vahonc vahonc self-assigned this Aug 25, 2023
@rbayet rbayet linked a pull request Sep 5, 2023 that will close this issue
vahonc added a commit to vahonc/elasticsuite that referenced this issue Sep 5, 2023
rbayet added a commit that referenced this issue Sep 5, 2023
…ned-property-2.11-fix

Fix #3030, avoid deprecated access to an undefined property
@hostep
Copy link
Contributor Author

hostep commented Sep 5, 2023

Thanks!

rbayet added a commit to rbayet/elasticsuite that referenced this issue Sep 5, 2023
rbayet added a commit to rbayet/elasticsuite that referenced this issue Sep 5, 2023
rbayet added a commit that referenced this issue Sep 5, 2023
Fixes #3030 deprecated access to an undefined property (2.10.x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants