convert object to string if possible instead of using var_export directly