-
-
Notifications
You must be signed in to change notification settings - Fork 141
Open
Description
https://www.php.net/manual/en/migration85.deprecated.php
"Using null as an array offset or when calling array_key_exists() is now deprecated. Instead an empty string should be used."
This is caused when doing eager loading with single key that is null
class A extends Model
{
use Compoships;
public function b(): HasMany
{
return $this->hasMany(B::class, 'c', 'c');
}
}
#[Test]
public function bug_reproduction(): void
{
A::factory()->create(['c' => null]);
A::query()->with(['b'])->get();
}
The deprication happens in Database/Eloquent/Relations/HasOneOrMany.php where dictKey will be null, which causes array null offset on line 240 in the following

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels