Make WordPress Core

Opened 12 months ago

Last modified 12 months ago

#58109 reopened defect (bug)

Fatal Error when changed Taxonomy from hierarchical False to True

Reported by: narenin's profile narenin Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.2
Component: Taxonomy Keywords:
Focuses: administration, coding-standards Cc:


When we changed hierarchical False to True for Taxonomy then we received Fatal Error.

[11:39 AM] Uncaught exception 'TypeError' with message 'array_map(): Argument #2 ($array) must be of type array, string given' in /var/www/wp-admin/includes/post.php:2091

This is happening because of taxonomy_meta_box_sanitize_cb_checkboxes function. This function not has the checked if the $term is array or not which is causing fatal error.

We can use is_array condition for this like already done in taxonomy_meta_box_sanitize_cb_input function.

Attachments (1)

Screenshot from 2023-04-10 12-59-02.png (149.5 KB) - added by narenin 12 months ago.

Download all attachments as: .zip

Change History (6)

#1 @mi5t4n
12 months ago

@narenin hello, could you tell us the steps to reproduce the issue?

#2 @narenin
12 months ago

  • Resolution set to invalid
  • Status changed from new to closed

Please find the steps below.

  1. Create a non-hierarchical custom taxonomy using register_taxonomy
  2. Now go to post and then assign some terms of that taxonomy to posts and then publish the post.
  3. Now change that non-hierarchical custom taxonomy to hierarchical custom taxonomy by using hierarchical=>true
  4. Now go to that post and try to save that post, you should get fatal error.

#3 @narenin
12 months ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

#4 @mi5t4n
12 months ago

@narenin I couldn't replicate the issue. Can you verify the issue still exists in the new blanks WP 6.2 without any plugins.

This ticket was mentioned in Slack in #core by oglekler. View the logs.

12 months ago

Note: See TracTickets for help on using tickets.