[wp-trac] [WordPress Trac] #10803: get_post_meta doesn't return an array when requested if nothing with that key exists.

WordPress Trac wp-trac at lists.automattic.com
Sun Sep 27 21:28:24 UTC 2009


#10803: get_post_meta doesn't return an array when requested if nothing with that
key exists.
--------------------------+-------------------------------------------------
 Reporter:  westi         |        Owner:  westi 
     Type:  defect (bug)  |       Status:  closed
 Priority:  normal        |    Milestone:  2.9   
Component:  General       |      Version:  2.8.4 
 Severity:  normal        |   Resolution:  fixed 
 Keywords:                |  
--------------------------+-------------------------------------------------
Changes (by westi):

  * keywords:  2nd-opinion =>
  * status:  reopened => closed
  * resolution:  => fixed
  * severity:  major => normal


Comment:

 -1 to adding a default argument.

 We don't need this - the function already had clear defined behaviour and
 it didn't conform to it.

 The example code shared above relied on a bug in the code.

 You asked the function to return you an array of results and it didn't
 instead it returned you the result you would have got for a request of a
 single value if one had not been set.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10803#comment:9>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list