1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-10 08:44:46 +02:00
This commit is contained in:
Ryan Cramer
2023-03-08 10:22:30 -05:00
parent 592a443bf1
commit bd6fe70347

View File

@@ -165,6 +165,14 @@ class Sanitizer extends Wire {
*/
protected $textTools = null;
/**
* Runtime caches
*
* @var array
*
*/
protected $caches = array();
/**
* UTF-8 whitespace hex codes
*
@@ -899,8 +907,15 @@ class Sanitizer extends Wire {
// proceed only if value has some non-ascii characters
if(ctype_alnum(str_replace($extras, '', $value))) {
// let regular pageName sanitizer handle this
return $this->pageName($value, false, $maxLength);
$k = 'pageNameUTF8.whitelistIsLowercase';
if(!isset($this->caches[$k])) {
$this->caches[$k] = $whitelist !== false && $tt->strtolower($whitelist) === $whitelist;
}
if($this->caches[$k] || $tt->strtolower($value) === $value) {
// whitelist supports only lowercase OR value is all lowercase
// let regular pageName sanitizer handle this
return $this->pageName($value, false, $maxLength);
}
}
// validate that all characters are in our whitelist