Last modified: 2009-03-07 12:59:47 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T19832, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 17832 - When blocked, action=delete returns "unknownerror" instead of "permissiondenied"
When blocked, action=delete returns "unknownerror" instead of "permissiondenied"
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.15.x
All All
: Normal normal (vote)
: ---
Assigned To: Roan Kattouw
: patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-03-07 04:08 UTC by Brad Jorsch
Modified: 2009-03-07 12:59 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Add a reset() in Title::getUserPermissionsErrors, so callers can use current() to get the first error. (278 bytes, patch)
2009-03-07 04:08 UTC, Brad Jorsch
Details

Description Brad Jorsch 2009-03-07 04:08:09 UTC
Created attachment 5897 [details]
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.
Comment 1 Roan Kattouw 2009-03-07 12:59:47 UTC
(In reply to comment #0)
> 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.
> 
Did the former in r48122: the calling code should not make any assumptions about where the array pointer in the returned array is. Using current() makes that assumption, while using reset() doesn't.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links