dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0367d94
)
Properly check whether a user exists
author
Kunal Mehta
<legoktm@gmail.com>
Mon, 14 Jul 2014 05:03:00 +0000
(22:03 -0700)
committer
Kunal Mehta
<legoktm@gmail.com>
Mon, 14 Jul 2014 05:03:00 +0000
(22:03 -0700)
User::newFromId() will never return false. We have to actually
load from the database to see whether the user still exists.
Change-Id: Id9329635717e6a4f1f34d0b2b665bb790685d2fa
includes/context/RequestContext.php
patch
|
blob
|
history
diff --git
a/includes/context/RequestContext.php
b/includes/context/RequestContext.php
index
cd18404
..
efdc6db
100644
(file)
--- a/
includes/context/RequestContext.php
+++ b/
includes/context/RequestContext.php
@@
-471,7
+471,8
@@
class RequestContext implements IContextSource {
if ( $params['userId'] ) { // logged-in user
$user = User::newFromId( $params['userId'] );
- if ( !$user ) {
+ $user->load();
+ if ( !$user->getId() ) {
throw new MWException( "No user with ID '{$params['userId']}'." );
}
} elseif ( !IP::isValid( $params['ip'] ) ) {