[wp-trac] [WordPress Trac] #9065: Can not store 0 (zero) in meta_value using update_usermeta() in user.php

WordPress Trac wp-trac at lists.automattic.com
Sat Feb 7 16:41:50 GMT 2009


#9065: Can not store 0 (zero) in meta_value using update_usermeta() in user.php
--------------------------+-------------------------------------------------
 Reporter:  stevejohnson  |       Owner:  anonymous
     Type:  defect (bug)  |      Status:  new      
 Priority:  normal        |   Milestone:  2.8      
Component:  General       |     Version:  2.7      
 Severity:  normal        |    Keywords:           
--------------------------+-------------------------------------------------
 The following lines in wp-includes/user.php evaluate $meta_value passed to
 update_usermeta() (current line #s from trunk):

 {{{
 397         if (empty($meta_value)) {
 398             return delete_usermeta($user_id, $meta_key);
 399         }
 }}}

 A numerical or string zero evals as empty, resulting in the inability to
 store zero as a meta_value.

 A better test for truly empty might be:

 {{{
 397         if ($meta_value == '')) {
 398             return delete_usermeta($user_id, $meta_key);
 399         }
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/9065>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list