Skip to content

Commit 67fbb51

Browse files
authored
Revert "[11.x] Fixes incorrectly serializing virtual properties (backport) (#…" (#57203)
This reverts commit 9c80cf4.
1 parent 9c80cf4 commit 67fbb51

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/Illuminate/Database/Eloquent/Model.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2421,15 +2421,7 @@ public function __sleep()
24212421
$this->classCastCache = [];
24222422
$this->attributeCastCache = [];
24232423

2424-
// When serializing the model, we may accidentally catch up some virtual properties.
2425-
// We will cast the model to a native array to skip them and then apply a function
2426-
// to clean each of the property names which is miles faster than using a regex.
2427-
return array_map(
2428-
fn ($key) => $key[0] === "\0"
2429-
? substr($key, strpos($key, "\0", 1) + 1)
2430-
: $key,
2431-
array_keys((array) $this)
2432-
);
2424+
return array_keys(get_object_vars($this));
24332425
}
24342426

24352427
/**

0 commit comments

Comments
 (0)