Skip to content

Update: Remove dynamic $features variable from the constructor of class-ftp.php#7540

Closed
Debarghya-Banerjee wants to merge 5 commits intoWordPress:trunkfrom
Debarghya-Banerjee:fix/features-variable-in-ftp-class
Closed

Update: Remove dynamic $features variable from the constructor of class-ftp.php#7540
Debarghya-Banerjee wants to merge 5 commits intoWordPress:trunkfrom
Debarghya-Banerjee:fix/features-variable-in-ftp-class

Conversation

@Debarghya-Banerjee
Copy link
Copy Markdown

@Debarghya-Banerjee Debarghya-Banerjee commented Oct 8, 2024

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 $features was 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 $features field 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

  • Removed the $features dynamic field from the constructor of the ftp class.

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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 8, 2024

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props debarghyabanerjee, audrasjb, hellofromtonya.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 8, 2024

Test using WordPress Playground

The 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

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@hellofromtonya
Copy link
Copy Markdown
Contributor

Hello @Debarghya-Banerjee,
Thank you for contributing this patch. Great job writing the PR's description 🏆

Where should this dynamic property be declared? By itself seems out-of-place. What about grouping it with the public variables?

@hellofromtonya
Copy link
Copy Markdown
Contributor

hellofromtonya commented Oct 10, 2024

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 _features property is used, but not the public one. Huh.

I wonder ... Could this property be removed? @costdev what do you think?

@Debarghya-Banerjee
Copy link
Copy Markdown
Author

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.

@Debarghya-Banerjee Debarghya-Banerjee changed the title Update: Add $features as a class field in class-ftp.php Update: Remove dynamic $features variable from the constructor of class-ftp.php Oct 31, 2024
@github-actions
Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 62059
GitHub commit: ae4aa15

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions bot closed this Mar 19, 2026
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 this pull request may close these issues.

3 participants