Opened 16 years ago
Closed 16 years ago
#7783 closed defect (bug) (fixed)
get_post() assign by reference fails; should copy instead
Reported by: | Sam_a | Owned by: | |
---|---|---|---|
Milestone: | 2.7 | Priority: | normal |
Severity: | normal | Version: | 2.6.1 |
Component: | General | Keywords: | get_post has-patch tested e_notice |
Focuses: | Cc: |
Description
get_post() tries to assign results of the $wpdb post query by reference (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( […]
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
get_post() assigns $wpdb row by value, not by reference. Stops E_NOTICEs in 2.6.2 and trunk