diff --git a/CHANGELOG.md b/CHANGELOG.md index 00e1761ab..4b1a12802 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ * Grav 1.6: Fixed `FlexObject::update()` removing fields on save * Fixed `mkdir(...)` race condition * Fixed `Obtaining write lock failed on file...` + * Fixed potential undefined property in `onPageNotFound` event handling # v1.6.0-rc.3 ## 02/18/2019 diff --git a/system/src/Grav/Common/Processors/PagesProcessor.php b/system/src/Grav/Common/Processors/PagesProcessor.php index bb8d44620..8b25255ee 100644 --- a/system/src/Grav/Common/Processors/PagesProcessor.php +++ b/system/src/Grav/Common/Processors/PagesProcessor.php @@ -36,7 +36,9 @@ class PagesProcessor extends ProcessorBase if (!$page->routable()) { // If no page found, fire event - $event = $this->container->fireEvent('onPageNotFound', new Event(['page' => $page])); + $event = new Event(['page' => $page]); + $event->page = null; + $event = $this->container->fireEvent('onPageNotFound', $event); if (isset($event->page)) { unset ($this->container['page']);