Skip to content
Snippets Groups Projects
Commit 30f3bd15 authored by Michael Grosse's avatar Michael Grosse
Browse files

Do not cache cleanID for $ascii == true

Caching must differentiate between a call with $ascii == true and a call
without that parameter. Since calling that function with $ascii == true
rare, we simply do not cache that case.
parent b018ecbe
No related branches found
No related tags found
No related merge requests found
......@@ -158,5 +158,15 @@ class init_clean_id_test extends DokuWikiTest {
}
}
function test_caching_ascii() {
global $conf;
$conf['deaccent'] = 0;
$this->assertEquals('pàge', cleanID('pàge',false));
$this->assertEquals('page', cleanID('pàge',true));
$this->assertEquals('page', cleanID('pagĖ',true));
$this->assertEquals('pagė', cleanID('pagĖ',false));
}
}
//Setup VIM: ex: et ts=4 :
......@@ -110,7 +110,7 @@ function cleanID($raw_id,$ascii=false){
$cache = & $cache_cleanid;
// check if it's already in the memory cache
if (isset($cache[(string)$raw_id])) {
if (!$ascii && isset($cache[(string)$raw_id])) {
return $cache[(string)$raw_id];
}
......@@ -143,7 +143,7 @@ function cleanID($raw_id,$ascii=false){
$id = preg_replace('#:[:\._\-]+#',':',$id);
$id = preg_replace('#[:\._\-]+:#',':',$id);
$cache[(string)$raw_id] = $id;
if (!$ascii) $cache[(string)$raw_id] = $id;
return($id);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment