Use var_export when writing configuration

Use var_export when writing configuration to avoid strange use of add/stripslashes. Fixes #2166.