Fix $replace parameter handling in get_config()

Code was reached only on first function call, then short-circuited because of the reference cache.
Ensure get_config() optional argument is an array, remove useless test
Allow items to be set even if they were not present yet
Adjustments in static reference handling
Merge pull request #2609 from vlakoff/develop-2

Fix $replace parameter handling in get_config()