Reverted in 3.1. We’re trying again in 3.2.
If you were using $wpdb->last_result, you will need to change it to $wpdb->get_results() without a $query argument, which does the same thing. Inside wpdb, we’re now passing resources around, so the last_result property (which was private and should not have been used) no longer exists.
On PHP5, we’re using a magic getter to return wpdb->get_results() for you, but it’ll throw a deprecated warning. On PHP4, your code will cease to work.
Further reading: #12257.
scribu 2:51 pm on November 12, 2010 Permalink
I’m always amased of how much old code (that I thought was solid) can be improved.
Brian Layman 3:36 pm on November 12, 2010 Permalink
Thank you for the heads-up Nacin. I’m pretty sure I used last_result in something, but I think it was a one off – blog conversion tool. In any case, advanced knowledge about this kind of thing is VERY helpful.
Appreciated!
Joe Hoyle 4:45 pm on November 12, 2010 Permalink
Does WordPress not use an underscore or something similar to mark private methods / properties? I only ask because how were users meant to know $wpdb->last_result was private?
Peter Westwood 4:47 pm on November 12, 2010 Permalink
For methods they will quite often have an underscore on the front if they are private yes. We also make things as
@access privatein the phpdoc.This was an attribute and not a method but it was marked as private:
Peter Westwood 10:50 pm on November 12, 2010 Permalink
Reverted for now in r16336 doesn’t seem to agree with HyperDB
Ramoonus 4:20 pm on November 13, 2010 Permalink
Who says HyperDB is good?
Brian Layman 3:58 pm on November 13, 2010 Permalink
So.. when a ticket like this comes through, how is it brought into backpress and then I suppose onto bbpress? I see that db-mysqli uses last_result at least in the old version of bbpress I have checked out.
I was wondering if it would help if I created a ticket in these projects or if it should just be left to happen when all the changes are reconciled after the WP 3.1 release.
Peter Westwood 6:55 pm on November 14, 2010 Permalink
In general it makes it to BackPress once it is stable enough and someone has the time
Tickets and Patches are much appreciated – releases the burden on waiting for me to find the time
hakre 11:59 pm on November 14, 2010 Permalink
is that get_results() or get_last_results()?