Merge pull request #2731 from creative-commoners/pulls/4/p81fix

ENH Various fixes for PHP 8.1 compatibility
This commit is contained in:
Guy Sartorelli 2022-04-13 16:10:56 +12:00 committed by GitHub
commit 13c1ae487f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -82,7 +82,7 @@ class SiteTreeURLSegmentField extends TextField
$page->URLSegment = $page->generateURLSegment($request->getVar('value'));
$count = 2;
while (!$page->validURLSegment()) {
$page->URLSegment = preg_replace('/-[0-9]+$/', null, $page->URLSegment) . '-' . $count;
$page->URLSegment = preg_replace('/-[0-9]+$/', '', $page->URLSegment) . '-' . $count;
$count++;
}

View File

@ -1652,7 +1652,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
// Ensure that this object has a non-conflicting URLSegment value.
$count = 2;
while (!$this->validURLSegment()) {
$this->URLSegment = preg_replace('/-[0-9]+$/', null, $this->URLSegment) . '-' . $count;
$this->URLSegment = preg_replace('/-[0-9]+$/', '', $this->URLSegment) . '-' . $count;
$count++;
}