WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#18257 closed defect (bug) (duplicate)

Fatal error: Cannot use object of type stdClass as array in /.../wp-includes/post.php on line 1202

Reported by: jmaimarc Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: needs-patch
Focuses: Cc:

Description

It's checking against empty() in the second half of the if() statement which can only be strings, integers, floats, NULL, TRUE/FALSE, arrays or variables.

The function get_post_type_labels() is passing a stdClass object into _get_custom_object_labels( $object, $nohier_vs_hier_defaults ).

$pt = get_post_type(); returns string into $pt
$obj = get_post_type_object($pt);
returns object into $obj
$posttype = get_post_type_labels($obj); returns ERROR

Change History (2)

comment:1 scribu3 years ago

Similar: #16310

comment:2 nacin3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Looks like a duplicate. Please note my comments there: The get_post_type_labels() function was not designed as a public function.

Note: See TracTickets for help on using tickets.