MDL-36690 Do not cache objects inside course.modinfo as they may fail to serialize

convert moodle_url (all other fields are numbers or strings) to string before caching and then back to moodle_url when restoring.
Otherwise serialized modinfo can contain \0 byte which cause problems in Postgres DB