Skip to content

Commit 8415e52

Browse files
xiphuxtpruvot
authored andcommitted
Fix language lookup bug in geshi
1 parent d5b57a4 commit 8415e52

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

include/controller/Controller_GraphData.class.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,10 @@ protected function LoadData()
106106

107107
if (!empty($lang) && ($lang !== 'Other')) {
108108

109-
/** buggy ? and uncatchable (error 500, no logs)
109+
/* if you have a bug here, check the "match the langname" regexp */
110110
$fulllang = $geshi->get_language_fullname($lang);
111111
if (!empty($fulllang))
112112
$lang = $fulllang;
113-
**/
114113
}
115114

116115
if (isset($data[$lang])) {

lib/geshi/geshi.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ function get_language_fullname($language)
808808
}
809809

810810
// match the langname
811-
if (!preg_match('/\'LANG_NAME\'\s*=>\s*\'((?:[^\']|\\\')+)\'/', $data, $matches)) {
811+
if (!preg_match("/'LANG_NAME'\s*=>\s*'(.+|(?:\\')+)'/", $data, $matches)) {
812812
$this->error = sprintf('Geshi::get_lang_fullname(%s): Regex can not detect language', $language);
813813
return false;
814814
}

0 commit comments

Comments
 (0)