[wp-trac] [WordPress Trac] #58789: Not countable. row_actions @ /wp-admin/includes/class-wp-list-table.php
WordPress Trac
noreply at wordpress.org
Sat Jun 22 11:41:10 UTC 2024
#58789: Not countable. row_actions @ /wp-admin/includes/class-wp-list-table.php
-------------------------------------------------+-------------------------
Reporter: Nate1 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: Administration | Version: 6.2
Severity: major | Resolution:
Keywords: has-patch has-unit-tests needs- | Focuses:
testing |
-------------------------------------------------+-------------------------
Comment (by lalitmehra):
Thanks @m1r0 I check this GitHub pull request
[https://github.com/WordPress/wordpress-develop/pull/6801 PR]. It's
helpful.
Also, To handle this more robustly, I can modify the code to ensure
$actions is always treated as an array before attempting to count its
elements by using this codes
{{{
protected function row_actions( $actions, $always_visible = false ) {
// Ensure $actions is an array
if ( ! is_array( $actions ) ) {
$actions = array();
}
$action_count = count( $actions );
if ( $action_count === 0 ) {
return '';
}
// Continue processing $actions as needed...
}
}}}
By implementing these changes, thus avoiding errors related to **null** or
non-array values. This should help in resolving the issue where
**$actions** is "not countable" across sites.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58789#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list