We used to convert all config values to strings for storage because strings are a common denominator for all possible storage engines. Since the storage process currently only deals with serialized PHP and YAML files, both of which support primitive data types, we removed this forced type casting so that config values can be stored and retrieved in the same format / types without having to be converted into a string in the process.
- No conversion is happening in storage and retrieval from storage
- No need to check whether config values are numeric or boolean when retrieving values from storage
This destroyed native support for alternative serialization formats, such as JSON and XML.
Storage Example:
// An integer value.
$items_limit = 10;
\Drupal::config('system.rss')->set('items.limit', $items_limit)->save();
var_dump(\Drupal::config('system.rss')->get('items.limit'));
Before this change this would output:
string(2) "10"
After this change it outputs:
int(10)
More examples:
Integers:
Before
weight: '0'
After
weight: 0
Booleans:
Before
status: '1'
After
status: true
Null:
Before
'visibility' => ''
After
'visibility' => NULL