If environment is not defined, it would not have an existing $check_locations array. Granted, that should never be the case, but we should try to be thorough just in case weird things happen. 

Please define $check_locations = array() prior to the if (defined...) check and revise the pull request. I'll be thrilled to include it then.