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

Fix the data dynamic property in WP_Term #4307

Conversation

anton-vlasenko
Copy link

@anton-vlasenko anton-vlasenko commented Apr 5, 2023

This PR aims to solve the issue with the WP_Term::$data dynamic property.
The WP_Term class employs the __get magic method to compute the object data.
However, since PHP 8.2 does not support dynamic properties, it is better to eliminate this approach.

Trac ticket: https://core.trac.wordpress.org/ticket/58087


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@anton-vlasenko anton-vlasenko changed the title Fix the 'data' dynamic property in WP_Term Fix the data dynamic property in WP_Term Apr 5, 2023
@anton-vlasenko anton-vlasenko changed the title Fix the data dynamic property in WP_Term Fix the data dynamic property in WP_Term Apr 5, 2023
@anton-vlasenko anton-vlasenko marked this pull request as ready for review April 5, 2023 19:15
@anton-vlasenko anton-vlasenko force-pushed the fix/wp-term-remove-dynamic-property branch from 24f1e96 to 993587a Compare September 19, 2023 18:21
@anton-vlasenko anton-vlasenko force-pushed the fix/wp-term-remove-dynamic-property branch from e6e9171 to 6ac4bff Compare September 25, 2023 20:02
anton-vlasenko added a commit to anton-vlasenko/wordpress-develop that referenced this pull request Sep 25, 2023
@anton-vlasenko
Copy link
Author

Thank you for the code review, @mukeshpanchal27.
I have resolved the merge conflict and addressed the feedback from the code review.
The PR is now ready for consideration.

anton-vlasenko added a commit to anton-vlasenko/wordpress-develop that referenced this pull request Oct 25, 2023
@anton-vlasenko anton-vlasenko force-pushed the fix/wp-term-remove-dynamic-property branch from caef2fc to 4059886 Compare October 25, 2023 09:23
@anton-vlasenko
Copy link
Author

I'm closing this PR as the solution needs more refinement.

@hellofromtonya
Copy link
Contributor

Reopening this PR as IMO it's the most simplistic approach to resolve the issue and goals (see my reasonings here).

Copy link

github-actions bot commented Aug 15, 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 antonvlasenko, hellofromtonya, mukesh27.

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

Copy link

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.

anton-vlasenko and others added 6 commits August 16, 2024 11:20
The WP_Term class employs the __get magic method to compute the object data.
However, since PHP 8.2 does not support dynamic properties, it is better to eliminate this approach.
Fix indentation.

Co-authored-by: Mukesh Panchal <[email protected]>
@hellofromtonya hellofromtonya force-pushed the fix/wp-term-remove-dynamic-property branch from 4059886 to a1bde27 Compare August 16, 2024 16:21
A few code quality improvements:

* Expanded docs.
* Renaming of variable to align to what they are: db columns.
@hellofromtonya
Copy link
Contributor

Reclosing this PR. Why? Discovered today that Core adds/uses a lot of dynamic properties for WP_Term. Thus, it no longer makes sense to only deal with the data property. A broader solution will be needed for all of the dynamic properties.

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