Loading core/lib/Drupal/Core/Config/Config.php +2 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,8 @@ public function save($has_trusted_data = FALSE) { // Ensure that the schema wrapper has the latest data. $this->schemaWrapper = NULL; $this->data = $this->castValue(NULL, $this->data); // Reclaim the memory used by the schema wrapper. $this->schemaWrapper = NULL; } else { foreach ($this->data as $key => $value) { Loading core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php +5 −1 Original line number Diff line number Diff line Loading @@ -459,9 +459,13 @@ public function testConfigSaveWithSchema(): void { ]; // Save config which has a schema that enforces types. $this->config('config_schema_test.schema_data_types') $config_object = $this->config('config_schema_test.schema_data_types'); $config_object ->setData($untyped_to_typed) ->save(); // Ensure the schemaWrapper property is reset after saving to prevent a // memory leak. $this->assertNull((new \ReflectionObject($config_object))->getProperty('schemaWrapper')->getValue($config_object)); $this->assertSame($typed_values, $this->config('config_schema_test.schema_data_types')->get()); // Save config which does not have a schema that enforces types. Loading Loading
core/lib/Drupal/Core/Config/Config.php +2 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,8 @@ public function save($has_trusted_data = FALSE) { // Ensure that the schema wrapper has the latest data. $this->schemaWrapper = NULL; $this->data = $this->castValue(NULL, $this->data); // Reclaim the memory used by the schema wrapper. $this->schemaWrapper = NULL; } else { foreach ($this->data as $key => $value) { Loading
core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php +5 −1 Original line number Diff line number Diff line Loading @@ -459,9 +459,13 @@ public function testConfigSaveWithSchema(): void { ]; // Save config which has a schema that enforces types. $this->config('config_schema_test.schema_data_types') $config_object = $this->config('config_schema_test.schema_data_types'); $config_object ->setData($untyped_to_typed) ->save(); // Ensure the schemaWrapper property is reset after saving to prevent a // memory leak. $this->assertNull((new \ReflectionObject($config_object))->getProperty('schemaWrapper')->getValue($config_object)); $this->assertSame($typed_values, $this->config('config_schema_test.schema_data_types')->get()); // Save config which does not have a schema that enforces types. Loading