How to reset location_provider_allowed as the first, my environment:

Samsung S7, LineageOS 14.1, which is Android 7.2.1.

I'm using tasker to set GPS On and Off in this way:

GPS On:

settings put secure location_providers_allowed +gps,network,wifi


GPS Off:

settings put secure location_providers_allowed -gps,network,wifi


Both script are running as root.

Somethink happend (maybe during I tested this scripts) and now I can't switch my GPS Off (in Settings menu), and when I list my settings in this way:

settings list secure


I can see this:

  location_providers_allowed=wifi,wifi,+network,+wifi,+network,+wifi,+network,...+wifi,network,network


It is very long line with cyclic contents.

Please, is there a way to reset this setting (perhaps another than factory reset of phone)?

Thanks in advance.
You should be able to change it to blank by executing

settings put secure location_providers_allowed ' '


If that doesn't work, directly modify the file settings_secure.xml located at /data/system/users/0/. Look for the line containing location_providers_allowed and edit the value for it.