[wp-trac] [WordPress Trac] #13319: Code improvement in _fill_single_user(): Pass by Reference PHP 4 fixes

WordPress Trac wp-trac at lists.automattic.com
Mon May 10 10:49:18 UTC 2010


#13319: Code improvement in _fill_single_user(): Pass by Reference PHP 4 fixes
--------------------------+-------------------------------------------------
 Reporter:  hakre         |       Owner:           
     Type:  defect (bug)  |      Status:  new      
 Priority:  normal        |   Milestone:  3.0      
Component:  General       |     Version:  3.0      
 Severity:  normal        |    Keywords:  has-patch
--------------------------+-------------------------------------------------
 Passing an array by reference does not make very much sense when it is
 used read only. It is read only in {{{_fill_single_user()}}} (PHP uses
 copy on write, not copy on read).

 I think what intended was, that objects in that array (the items in there
 are an array of database result objects) are passed by reference so that
 they play nicely with PHP 4. To achieve this, care must be taken with the
 iterator that it does not create copies of the objects in that array of
 result objects there.

 {{{maybe_unserialize()}}} should be safe to use since database objects
 meta_value's property should contain scalars only.

 The same is for {{{get_user_metavalues()}}} which is not reflecting the
 propper iteration over the resultset.

 This all then escalated up to {{{_fill_many_users()}}} which is not
 properly handling those results as well.

 Additional to those reference related fixes, some code-cleanup has been
 done according to the standard.

 I had no problems running this on my testbed.

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


More information about the wp-trac mailing list