CodeIgniter
CodeIgniter copied to clipboard
Always default language will load in Lang.php CI3
I was just testing CI 3 and I think there is a little bug in system/core/Lang.php on line 109
if (empty($idiom) OR ! preg_match('/^[a-z_-]$/i', $idiom))
This condition is always true, check out this example :
$idiom = 'english';
if (empty($idiom) OR ! preg_match('/^[a-z_-]$/i', $idiom)) {
echo 'load default language';
}
This will print "load default language" (I think code is clear enough so I don't write a complete CI example) The issue is the regex used in condition I did not know how to edit and fix it so I opened an issue
I confirm. This is what I see as a fix:
if (empty($idiom) OR ! preg_match('/^[a-z_-]+$/i', $idiom))