Make WordPress Core

Opened 12 years ago

Closed 12 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's profile jmaimarc Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: needs-patch
Focuses: Cc:


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)

#1 @scribu
12 years ago

Similar: #16310

#2 @nacin
12 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.