[wp-trac] [WordPress Trac] #7783: get_post() assign by reference fails; should copy instead

WordPress Trac wp-trac at lists.automattic.com
Tue Sep 23 16:47:55 GMT 2008


#7783: get_post() assign by reference fails; should copy instead
---------------------+------------------------------------------------------
 Reporter:  Sam_a    |       Owner:  anonymous                         
     Type:  defect   |      Status:  new                               
 Priority:  normal   |   Milestone:  2.8                               
Component:  General  |     Version:  2.6.1                             
 Severity:  normal   |    Keywords:  get_post has-patch tested e_notice
---------------------+------------------------------------------------------
 get_post() tries to assign results of the $wpdb post query by reference
 ([http://trac.wordpress.org/browser/tags/2.6.2/wp-includes/post.php#L218
 wp-includes/post.php#L218]) —

 {{{
 $_post = & $wpdb->get_row( […]
 }}}

 — but this fails (with notice "Only variables should be assigned by
 reference") because $wpdb->get_row() doesn't return a reference.

 I think this must be a mistake, because normal assignment would work just
 as well and doesn't raise an error:

 {{{
 $_post = $wpdb->get_row( […]
 }}}

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


More information about the wp-trac mailing list