Update: Remove dynamic $features variable from the constructor of class-ftp.php#7540
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
Hello @Debarghya-Banerjee, Where should this dynamic property be declared? By itself seems out-of-place. What about grouping it with the public variables? |
|
Huh, I don't see where this property is used in the class or the child classes, except for where it's set to an empty array in the constructor. The private I wonder ... Could this property be removed? @costdev what do you think? |
|
Hi @hellofromtonya , I am updating the PR and removing the property, since after checking found that this field is not being used anywhere, hence it's better to remove, I am updating the PR and pushing the latest code. |
Trac Ticket: Core-62159
Problem Statement
In PHP 8.2, the creation of dynamic properties is deprecated, which affects the ftp class where the property
$featureswas previously created dynamically. This change could lead to warnings and potential issues in future versions of PHP.Solution
This PR addresses the issue by removing the dynamic
$featuresfield from ftp class as it's not being used anywhere. This ensures compliance with PHP 8.2 standards and eliminates the use of dynamic properties.Changes Made
Benefits
Resolves deprecation warnings in PHP 8.2, ensuring compatibility with future PHP versions.
Improves code quality and maintainability by defining class properties explicitly.
Testing
Verified that the changes do not introduce any errors or warnings in PHP 8.2.
Conducted unit tests to ensure that the functionality of the ftp class remains intact.