[wp-trac] [WordPress Trac] #61681: PHP Fatal error: Uncaught Error: Object of class WP_Comment could not be converted to string

WordPress Trac noreply at wordpress.org
Wed Jul 17 19:17:25 UTC 2024


#61681: PHP Fatal error:  Uncaught Error: Object of class WP_Comment could not be
converted to string
--------------------------+---------------------
 Reporter:  ambrosiawt    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  6.6.1
Component:  Comments      |     Version:  6.6
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+---------------------

Comment (by hellofromTonya):

 Oh wait, what if an instance of `WP_Comment` is instantiated ''before'' it
 has an assigned ID. The ID is auto-assigned in the database. So if a new
 comment is instantiated but not yet saved in the database, the
 `comment_ID` property should be empty.

 Testing this theory and writing tests to show it.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61681#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list