[wp-trac] [WordPress Trac] #37469: WP_Post_Type class causes fatal error for themes/plugins that cast post objects as stdClass

WordPress Trac noreply at wordpress.org
Tue Jul 26 16:03:15 UTC 2016


#37469: WP_Post_Type class causes fatal error for themes/plugins that cast post
objects as stdClass
-------------------------------+----------------------
 Reporter:  modernnerd         |       Owner:
     Type:  defect (bug)       |      Status:  closed
 Priority:  normal             |   Milestone:
Component:  Posts, Post Types  |     Version:  trunk
 Severity:  normal             |  Resolution:  invalid
 Keywords:                     |     Focuses:
-------------------------------+----------------------
Changes (by ocean90):

 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 Hello @modernnerd, thanks for your report.

 That part is actually
 [http://www.php.net/manual/en/language.oop5.typehinting.php type hinting],
 not a [http://php.net/manual/de/language.types.type-
 juggling.php#language.types.typecasting type cast].

 `stdClass` isn't really an useful type hint. Type hinting should only be
 used for "real" classes. Closing as a wontfix because we already had such
 changes in the past, for example `WP_Term` [34997], `WP_Comment` [33891],
 or `WP_Site` [36393].

 I suggest to contact the author of the theme and inform them about
 https://make.wordpress.org/core/2016/07/13/wp_post_type-in-4-6/.

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


More information about the wp-trac mailing list