MDL-35412 core: Moving get_string out of if statement