From: Fomafix Date: Wed, 27 Jun 2018 10:16:26 +0000 (+0200) Subject: Throw exception on wrong type in Language::isValidCode( $code ) X-Git-Tag: 1.34.0-rc.0~2531^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=197a82eda02768a4c69f97efde258bd7f1f13227;p=lhc%2Fweb%2Fwiklou.git Throw exception on wrong type in Language::isValidCode( $code ) This prevents that Language::isValidCode( null ) returns true. Depends-On: I38d8358469903afb15331212206635283cedcd46 Change-Id: I5dc5bd45d648a548dfd27aaa1b3c29a2e99f0e8b --- diff --git a/languages/Language.php b/languages/Language.php index 5ac2882716..aaaf2a206c 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -386,6 +386,7 @@ class Language { */ public static function isValidCode( $code ) { static $cache = []; + Assert::parameterType( 'string', $code, '$code' ); if ( !isset( $cache[$code] ) ) { // People think language codes are html safe, so enforce it. // Ideally we should only allow a-zA-Z0-9-