Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ad7a45d

Browse filesBrowse files
committed
Throw an exception if bootIfNotBooted is called while booting
- This infers that something in the boot process expected the boot to already be finished. - If we just ignore the call then the model class would be in an inconsistent state for whichever code called it.
1 parent b525a36 commit ad7a45d
Copy full SHA for ad7a45d

File tree

Expand file treeCollapse file tree

1 file changed

+4
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-0
lines changed

‎src/Illuminate/Database/Eloquent/Model.php

Copy file name to clipboardExpand all lines: src/Illuminate/Database/Eloquent/Model.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use ArrayAccess;
66
use Closure;
7+
use Exception;
78
use Illuminate\Contracts\Broadcasting\HasBroadcastChannel;
89
use Illuminate\Contracts\Queue\QueueableCollection;
910
use Illuminate\Contracts\Queue\QueueableEntity;
@@ -291,6 +292,9 @@ public function __construct(array $attributes = [])
291292
protected function bootIfNotBooted()
292293
{
293294
if (! isset(static::$booted[static::class])) {
295+
if (isset(static::$booting[static::class])) {
296+
throw new Exception('"'.__METHOD__.'" cannot be called on the "'.static::class.'" class while it is already being booted.');
297+
}
294298

295299
static::$booting[static::class] = true;
296300

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.