From 6bea5778d723fadf5fc1d74d2685c3a8601d4084 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Fri, 8 Apr 2022 12:38:38 +1200 Subject: [PATCH] ENH Various fixes for PHP 8.1 compatibility --- code/Forms/SiteTreeURLSegmentField.php | 2 +- code/Model/SiteTree.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/Forms/SiteTreeURLSegmentField.php b/code/Forms/SiteTreeURLSegmentField.php index bd26ca71..2e3a44b0 100644 --- a/code/Forms/SiteTreeURLSegmentField.php +++ b/code/Forms/SiteTreeURLSegmentField.php @@ -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++; } diff --git a/code/Model/SiteTree.php b/code/Model/SiteTree.php index c633962c..458ec9c5 100755 --- a/code/Model/SiteTree.php +++ b/code/Model/SiteTree.php @@ -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++; }