[wp-trac] [WordPress Trac] #39164: WP 4.7 broke get_post_type or requires an explicit integer value?

WordPress Trac noreply at wordpress.org
Thu Dec 8 02:48:25 UTC 2016


#39164: WP 4.7 broke get_post_type or requires an explicit integer value?
--------------------------+----------------------
 Reporter:  ssuess        |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  General       |     Version:  4.7
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+----------------------
Changes (by dd32):

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


Comment:

 This was an intentional change to `get_post()` in 4.7 - passing an invalid
 parameter may have previously returned a result, but it could've been an
 incorrect resource, for example, a value being cast to a numeric `1` and
 fetching from the incorrect post.

 `get_post( 123 )` is the same as `get_post( '123' )`  but not the same as
 `get_post( "  123  " )` (Which now fails) IMHO, so I agree with the
 change, especially in this case.

 For reference, see #37738

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


More information about the wp-trac mailing list