Add a reset() in Title::getUserPermissionsErrors, so callers can use current() to get the first error.
If a blocked user with the "delete" right tries to delete a page using the API action=delete, the response is "unknownerror" rather than the expected "permissiondenied". The problem is that the API code uses PHP's current() to try to retrieve one error from the returned error array, but $title->getUserPermissionsErrors() leaves the array's internal position in the past-the-end state so current() returns false. FWIW, this seems to have been broken in r36692.
While the API could be changed all over the place to use reset() instead of current(), it seems easier to just add the reset in getUserPermissionsErrors(); the attached patch does just that.