If the phlegm does not reach the mouth, it does not break the fast; this is undisputed in the Ḥanbalī madhhab. If it does reach the mouth however, the scholars have two opinions in this regard.
Some of them said that it does break the fast comparing the phlegm to food and drink. Others said it does not thus comparing it to saliva; as saliva does not break a person’s fast even if he was to accumulate it (in his mouth) and then swallow it his fast would not be invalidated. And this is the strongest opinion as there is no evidence to prove his fast is invalid.
Majmūʿ Durūs Wa Fatāwā Al-Ḥaram Al-Makkī, Muḥammad b. Ṣaliḥ Al- ʿUthaymīn, Volume 3, Page 49