mirror of
https://github.com/processwire/processwire.git
synced 2025-08-10 08:44:46 +02:00
Fix issue processwire/processwire-issues#1699
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user