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:
314aaf6
)
If the given title is bad, don't die horribly but return a null user
author
Brion Vibber
<brion@users.mediawiki.org>
Mon, 26 Apr 2004 07:32:52 +0000
(07:32 +0000)
committer
Brion Vibber
<brion@users.mediawiki.org>
Mon, 26 Apr 2004 07:32:52 +0000
(07:32 +0000)
includes/User.php
patch
|
blob
|
history
diff --git
a/includes/User.php
b/includes/User.php
index
6b0632d
..
b0a5afc
100644
(file)
--- a/
includes/User.php
+++ b/
includes/User.php
@@
-44,13
+44,19
@@
class User {
/* static */ function idFromName( $name )
{
$nt = Title::newFromText( $name );
/* static */ function idFromName( $name )
{
$nt = Title::newFromText( $name );
+ if( is_null( $nt ) ) {
+ # Illegal name
+ return null;
+ }
$sql = "SELECT user_id FROM user WHERE user_name='" .
wfStrencode( $nt->getText() ) . "'";
$res = wfQuery( $sql, DB_READ, "User::idFromName" );
$sql = "SELECT user_id FROM user WHERE user_name='" .
wfStrencode( $nt->getText() ) . "'";
$res = wfQuery( $sql, DB_READ, "User::idFromName" );
- if ( 0 == wfNumRows( $res ) ) { return 0; }
- else {
+ if ( 0 == wfNumRows( $res ) ) {
+ return 0;
+ } else {
$s = wfFetchObject( $res );
$s = wfFetchObject( $res );
+ wfFreeResult( $res );
return $s->user_id;
}
}
return $s->user_id;
}
}