[wp-trac] [WordPress Trac] #61890: Handle WP_Term dynamic properties for PHP 8.2

WordPress Trac noreply at wordpress.org
Tue Aug 27 16:25:40 UTC 2024


#61890: Handle WP_Term dynamic properties for PHP 8.2
-------------------------------------+-------------------------------------
 Reporter:  hellofromTonya           |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  6.7
Component:  Taxonomy                 |     Version:  4.4
 Severity:  minor                    |  Resolution:
 Keywords:  php82 has-patch has-     |     Focuses:  coding-standards, php-
  unit-tests needs-testing needs-    |  compatibility
  dev-note has-testing-info          |
-------------------------------------+-------------------------------------

Comment (by hellofromTonya):

 == Test Result for Customer Reviews for WooCommerce

 Plugin:[https://wordpress.org/plugins/customer-reviews-woocommerce/
 Customer Reviews for WooCommerce] version 5.59.0.


 Test: Does this plugin work with its `(array) $tag`? Or does it require
 changing to use `$tag->to_array()`?

 This plugin is [https://plugins.trac.wordpress.org/browser/customer-
 reviews-woocommerce/tags/5.59.0/includes/tags/class-cr-admin-menu-
 tags.php#L183 type casting a tag object to an `array`] instead of using
 `to_array()` method:

 {{{
 'supplemental' => (array) $tag,
 }}}

 Patch tested: https://github.com/WordPress/wordpress-develop/pull/7231

 === Environment
 - OS: macOS
 - Web Server:
   - For after: Nginx (with wp docker)
   - For before: Nginx via Local
 - PHP: 8.2.22
 - WordPress: 6.6.1 (for before) and `trunk` (for after)
 - Browser: Firefox 129.0.1
 - Theme: See testing instructions
 - Active Plugins:
    - Customer Reviews for WooCommerce version 5.59.0
    - WooCommerce version 9.2.3

 === Testing Instructions

 1. Navigate to Reviews > Review Tagging
 2. Add a new tag in the "Create New Tag" text field.
 3. Press/click/trigger the "Create New Tag" button.

 === Expected Results

 The tag should be created, page refreshes automatically, and the tag is
 shown in the list table.

 === Actual Results

 - ✅ On WP 6.6.1: the tag should be created, page refreshes automatically,
 and the tag is shown in the list table.

 - On trunk with this patch:
   - ❌ the spinner spins and the page does not refresh.
   - ✅ When manually refreshing the tag, the tag was created and it shows
 in the tag list table.

 After modifying the code in the plugin to use `$tag->to_array()`:
   - ✅ On trunk with this patch: the tag should be created, page refreshes
 automatically, and the tag is shown in the list table.
   - ✅ On WP 6.6.1: the tag should be created, page refreshes
 automatically, and the tag is shown in the list table.

 === Conclusion
 This plugin will need to change from `(array) $tag` to `$tag->to_array()`.
 The change will work on older and new WordPress versions.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61890#comment:24>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list