WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 4 years ago

#14606 closed defect (bug) (invalid)

Fatal error: Cannot use object of type stdClass as array

Reported by: bigtalk Owned by:
Milestone: Priority: normal
Severity: blocker Version: 3.0.1
Component: General Keywords: reporter-feedback
Focuses: Cc:

Description

I get the PHP error:

Fatal error: Cannot use object of type stdClass as array

The most recent one was from wp-includes/post.php on line 1830 when trying to trash a comment.

I have already fixed numerous instances of this problem in the app I have installed just to get it to install. At this point, there are too many instances for me to fix them all.

I am using PHP 5.3.2

I believe it is a matter of changing (for example on line 1830 of wp-includes/post.php)"

add_post_meta($post_id,'_wp_trash_meta_status', $post['post_status']);

to

add_post_meta($post_id,'_wp_trash_meta_status', $post->post_status);

Change History (3)

comment:1 @wojtek.szkutnik5 years ago

are you sure that your "output" argument is set to ARRAY_A ?

comment:2 @scribu5 years ago

  • Keywords reporter-feedback added

comment:3 @nacin4 years ago

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

In this case, the post is being fetched as ARRAY_A. An object should not be returned.

Please re-open with more information.

Note: See TracTickets for help on using tickets.