For a period of four days in May, about 14 million Facebook users around the world had their default sharing setting for all new posts set to public, the company revealed Thursday.

The bug, which affected those users from May 18 to May 22, occurred while Facebook was testing a new feature.

After Facebook employees discovered the bug, the company went back and changed the privacy settings for all posts shared by those 14 million users during that time.

Facebook changed every post by those users during the affected time period to private, including posts that people may have meant to share publicly. The company told CNN it took five days to make those changes.

Affected Facebook users will get a notification on the app or website starting Thursday. They'll see a message from Facebook urging users to "Please Review Your Posts" and a link to a list of what they shared on Facebook while the bug was active.

Related: Facebook faces new regulatory backlash over data privacy

Facebook posts typically default to the last "audience" a post was shared with, such as family members, friends, or friends except their boss. That default was changed to public for the 14 million users, but if affected users noticed, they could have manually switched the setting themselves.

"We recently found a bug that automatically suggested posting publicly when some people were creating their Facebook posts," said Erin Egan, Facebook's chief privacy officer. "We have fixed this issue and starting today we are letting everyone affected know and asking them to review any posts they made during that time. To be clear, this bug did not impact anything people had posted before -- and they could still choose their audience just as they always have."

A Facebook spokesperson said the notification is the start of new proactive and transparent way for the company to handle issues going forward.