diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b1f54f..effc963 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Release Notes for Guest Entries +## Unreleased + +### Fixed +- Fixed a PHP error that could occur on validation failure. ([#87](https://github.com/craftcms/guest-entries/issues/87)) + ## 4.0.0 - 2024-03-19 - Added Craft 5 compatibility. diff --git a/src/controllers/SaveController.php b/src/controllers/SaveController.php index 50b4a77..d5cad12 100644 --- a/src/controllers/SaveController.php +++ b/src/controllers/SaveController.php @@ -176,9 +176,9 @@ private function _returnSuccess(Entry $entry, $isSpam = false): Response * * @param Settings $settings * @param Entry $entry - * @return Response + * @return Response|null */ - private function _returnError(Settings $settings, Entry $entry): Response + private function _returnError(Settings $settings, Entry $entry): ?Response { if ($this->hasEventHandlers(self::EVENT_AFTER_ERROR)) { $this->trigger(self::EVENT_AFTER_ERROR, new SaveEvent([