Make WordPress Core

Opened 7 years ago

Last modified 6 years ago

#43804 new defect (bug)

Undefined offset: 0 in ../wp-includes/taxonomy.php on line 1903

Reported by: vasyltech's profile vasyltech Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: has-patch reporter-feedback
Focuses: Cc:

Description

The issue is pretty trivial. When there are no terms assigned to a post, the condition on 1894 will return false and this immediately will cause PHP error because $taxonomies array does not have any records inside.

To reproduce the issue, simply call wp_get_object_terms function with post, page or custom post type that does not have a single hierarchical term assigned to.

Attachments (2)

fix.patch (89 bytes) - added by vasyltech 7 years ago.
Straight forward fix for the "PHP Notice: Undefined offset: 0 in ../wp-includes/taxonomy.php on line 1903" error
43804.diff (793 bytes) - added by birgire 7 years ago.

Download all attachments as: .zip

Change History (4)

@vasyltech
7 years ago

Straight forward fix for the "PHP Notice: Undefined offset: 0 in ../wp-includes/taxonomy.php on line 1903" error

@birgire
7 years ago

#1 @birgire
7 years ago

  • Component changed from General to Taxonomy
  • Keywords reporter-feedback added

Welcome to WordPress Trac @vasyltech

Thanks for the report.

But I'm unable to reproduce this.

I've attached my test in 43804.diff

Can you elaborate further how we can reproduce the bug?

Thanks.

#2 @pento
6 years ago

  • Version trunk deleted
Note: See TracTickets for help on using tickets.