Sanitization

This script updates the users and user_location tables to replace sensitive data like phones number, names, addresses by 'hidden'.
The update request on users table is split in smaller requests of 500 lines each to avoid the server to cut the connexion.

I wasn't clear in my email about unserializing : 

In order to get the data contained in the data field of the users table, I have to use the unserialize function, which fails on 8425 (out of 37601) users. It doesn't prevent the script to work but I just cannot access the data, I looked closely to several user's data and there is just nothing wrong there, sometimes it would work after I deleted a portion of text, apparently it would be en encoding problem (even though the text I had deleted didn't contain any special characters) but I havent found any solution to it.
So my question was, what do we do with these users's data ?
Right now the script just recopy the serialized data (line 106) to avoid a null value, so the sensitive informations are not hidden.
As I read, the function could also work fine on your server...

I haven't seen the other scripts you told me, I could base the data on the user id if you need it (?)

The big array in comment is for the case we would want to replace the not unserializing data with default values.