From 902fed3431b24cf8df384bf9598273e7e62df853 Mon Sep 17 00:00:00 2001 From: Xurshudyan Date: Sat, 29 Nov 2025 13:49:54 +0400 Subject: [PATCH] Ensure missing-attribute prevention flag is always restored --- src/Illuminate/Database/Eloquent/Model.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Illuminate/Database/Eloquent/Model.php b/src/Illuminate/Database/Eloquent/Model.php index be5ae2f438b0..2b6deb58333f 100644 --- a/src/Illuminate/Database/Eloquent/Model.php +++ b/src/Illuminate/Database/Eloquent/Model.php @@ -2447,11 +2447,11 @@ public function offsetExists($offset): bool static::$modelsShouldPreventAccessingMissingAttributes = false; - $result = ! is_null($this->getAttribute($offset)); - - static::$modelsShouldPreventAccessingMissingAttributes = $shouldPrevent; - - return $result; + try { + return ! is_null($this->getAttribute($offset)); + } finally { + static::$modelsShouldPreventAccessingMissingAttributes = $shouldPrevent; + } } /**