diff --git a/wire/core/Sanitizer.php b/wire/core/Sanitizer.php index 0722cec5..de241007 100644 --- a/wire/core/Sanitizer.php +++ b/wire/core/Sanitizer.php @@ -55,7 +55,7 @@ public function __construct() { * @param array $allowedExtras Additional characters that are allowed in the value * @param string 1 character replacement value for invalid characters * @param bool $beautify Whether to beautify the string, specify Sanitizer::translate to perform transliteration. - * @param int $maxLength + * @param mixed $maxLength Maximum length for input, false for no limit * @return string * */ @@ -90,7 +90,7 @@ public function nameFilter($value, array $allowedExtras, $replacementChar, $beau $needsWork = strlen(str_replace($allowed, '', $value)); } - if(strlen($value) > $maxLength) $value = substr($value, 0, $maxLength); + if((ctype_digit($maxLength) || is_int($maxLength)) && strlen($value) > $maxLength) $value = substr($value, 0, $maxLength); if($needsWork) { $value = str_replace(array("'", '"'), '', $value); // blank out any quotes diff --git a/wire/core/WireInput.php b/wire/core/WireInput.php index e36c9db2..b6626cb8 100644 --- a/wire/core/WireInput.php +++ b/wire/core/WireInput.php @@ -259,7 +259,7 @@ public function setUrlSegment($num, $value) { $this->urlSegments = $urlSegments; } else { // set - $this->urlSegments[$num] = wire('sanitizer')->name($value); + $this->urlSegments[$num] = wire('sanitizer')->name($value,false,false); } }