Make WordPress Core

Opened 8 years ago

Closed 5 months ago

#43804 closed defect (bug) (invalid)

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

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

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 8 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 8 years ago.

Download all attachments as: .zip

Change History (5)

@vasyltech
8 years ago

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

@birgire
8 years ago

#1 @birgire
8 years ago

  • Component GeneralTaxonomy
  • 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
8 years ago

  • Version trunk

#3 @desrosj
5 months ago

  • Milestone Awaiting Review
  • Resolutioninvalid
  • Status newclosed

I'm going to close this out because there has been no additional reporter-feedback for some time. @vasyltech if you are still experiencing this issue, please reopen with more context.

Note: See TracTickets for help on using tickets.