mirror of
https://github.com/processwire/processwire.git
synced 2025-08-13 18:24:57 +02:00
Fix issue processwire/processwire-issues#1699
This commit is contained in:
@@ -165,6 +165,14 @@ class Sanitizer extends Wire {
|
|||||||
*/
|
*/
|
||||||
protected $textTools = null;
|
protected $textTools = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runtime caches
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
protected $caches = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UTF-8 whitespace hex codes
|
* UTF-8 whitespace hex codes
|
||||||
*
|
*
|
||||||
@@ -899,8 +907,15 @@ class Sanitizer extends Wire {
|
|||||||
|
|
||||||
// proceed only if value has some non-ascii characters
|
// proceed only if value has some non-ascii characters
|
||||||
if(ctype_alnum(str_replace($extras, '', $value))) {
|
if(ctype_alnum(str_replace($extras, '', $value))) {
|
||||||
// let regular pageName sanitizer handle this
|
$k = 'pageNameUTF8.whitelistIsLowercase';
|
||||||
return $this->pageName($value, false, $maxLength);
|
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
|
// validate that all characters are in our whitelist
|
||||||
|
Reference in New Issue
Block a user