The Portuguese government has put an end to an exceptional regime that allowed foreigners to enter Portugal and then apply for a residence permit.