Init vars with a value if none is provided

Resolves https://github.com/owncloud/core/issues/10601 and multiple error loggings throughout the system

Cc: @DeepDiver1975 @PVince81