Solder does go bad, but on much longer time scales than most people here are talking about. I have quite a bit of flux core solder vintage 1960-1970 that is just fine. I do have some slightly older flux core that has perished, but it had nicks that penetrated the core. In normal use the ends of the solder are well sealed and will last for decades. If you have small broken pieces of flux core solder I would recommend using them quickly, within a small number of years.
Acid core solder, once used in plumbing degrades relatively quickly, even if the ends of the solder are sealed at storage. Time frame is a few decades.
Solid solder oxidizes slowly in air. I have some examples inherited from my grandfather that are nearing 100 years old that have a thick crust of oxidation on them. Still usable with difficulty, but that is largely because solder sizes were much larger in that era, on the order of 2 to 5 mm diameter. I suspect that in today's sizes the solder would be unusable after five or six decades.
These experiences have involved somewhat benign storage conditions - relatively dry and modest temperature swings. If your conditions are worse you might end up shortening the life of the solder somewhat.