File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ All notable changes to this project will be documented in this file.
8
8
* Rename queue option ` table ` to ` collection `
9
9
* Replace queue option ` expire ` with ` retry_after `
10
10
11
+ ## [ 4.3.1]
12
+
13
+ * Fix memory leak when filling nested fields using dot notation by @GromNaN in [ #2962 ] ( https://github.com/mongodb/laravel-mongodb/pull/2962 )
14
+
11
15
## [ 4.3.0] - 2024-04-26
12
16
13
17
* New aggregation pipeline builder by @GromNaN in [ #2738 ] ( https://github.com/mongodb/laravel-mongodb/pull/2738 )
Original file line number Diff line number Diff line change 46
46
use function str_contains ;
47
47
use function str_starts_with ;
48
48
use function strcmp ;
49
- use function uniqid ;
50
49
use function var_export ;
51
50
52
51
/** @mixin Builder */
@@ -55,6 +54,8 @@ abstract class Model extends BaseModel
55
54
use HybridRelations;
56
55
use EmbedsRelations;
57
56
57
+ private const TEMPORARY_KEY = '__LARAVEL_TEMPORARY_KEY__ ' ;
58
+
58
59
/**
59
60
* The collection associated with the model.
60
61
*
@@ -271,12 +272,10 @@ public function setAttribute($key, $value)
271
272
// Support keys in dot notation.
272
273
if (str_contains ($ key , '. ' )) {
273
274
// Store to a temporary key, then move data to the actual key
274
- $ uniqueKey = uniqid ($ key );
275
-
276
- parent ::setAttribute ($ uniqueKey , $ value );
275
+ parent ::setAttribute (self ::TEMPORARY_KEY , $ value );
277
276
278
- Arr::set ($ this ->attributes , $ key , $ this ->attributes [$ uniqueKey ] ?? null );
279
- unset($ this ->attributes [$ uniqueKey ]);
277
+ Arr::set ($ this ->attributes , $ key , $ this ->attributes [self :: TEMPORARY_KEY ] ?? null );
278
+ unset($ this ->attributes [self :: TEMPORARY_KEY ]);
280
279
281
280
return $ this ;
282
281
}
You can’t perform that action at this time.
0 commit comments