dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
(from parent 1:
9b37fd1
)
Merge "(bug 36908) Language::isValidBuiltInCode passed an object"
author
Aaron Schulz
<aschulz@wikimedia.org>
Fri, 18 May 2012 21:50:35 +0000
(21:50 +0000)
committer
Gerrit Code Review
<gerrit@wikimedia.org>
Fri, 18 May 2012 21:50:35 +0000
(21:50 +0000)
languages/Language.php
patch
|
blob
|
history
diff --git
a/languages/Language.php
b/languages/Language.php
index
b36732b
..
240b0d3
100644
(file)
--- a/
languages/Language.php
+++ b/
languages/Language.php
@@
-245,6
+245,15
@@
class Language {
* @return bool
*/
public static function isValidBuiltInCode( $code ) {
+
+ if( !is_string($code) ) {
+ $type = gettype( $code );
+ if( $type === 'object' ) {
+ $addmsg = " of class " . get_class( $code );
+ }
+ throw new MWException( __METHOD__ . " must be passed a string, $type given$addmsg" );
+ }
+
return preg_match( '/^[a-z0-9-]+$/i', $code );
}