-
Notifications
You must be signed in to change notification settings - Fork 217
Description
On line 813 of Stringify.php there is a function called slugify(). I had to add an escape character in the regex pattern on the dash or hyphen to prevent the error message. I'm not sure if that hyphen was intended to be unescaped. I made the following change to that function to prevent the error and allow the pages to load correctly.
Apparently the hyphen needs to be either the first or last character in the pattern, or escaped: invalid range in character class
public function slugify($replacement = '-')
{
$stringy = $this->toAscii();
$quotedReplacement = preg_quote($replacement);
// $pattern = "/[^a-zA-Z\d\s-_$quotedReplacement]/u"; // Commented this out.
$pattern = "/[^a-zA-Z\d\s\-_$quotedReplacement]/u"; // Added backslash in front of the hyphen.
$stringy->str = preg_replace($pattern, '', $stringy);
return $stringy->toLowerCase()->delimit($replacement)
->removeLeft($replacement)->removeRight($replacement);
}