A stay in Poland is considered legal if it takes place during the period of validity of the entry and stay entitlement. The entry and stay entitlement includes: a visa, a temporary residence permit, a permanent residence permit, or a residence permit for a long-term resident of the EU. In addition, foreigners who are exempt from the visa requirement may enter and stay in Poland under so called visa-free travel. The conditions of entry and stay, as well as the list of countries whose citizens are exempt from the visa requirement, can be found on the website of the Office for Foreigners: https://udsc.gov.pl/cudzoziemcy/obywatele-panstw-trzecich/chce-przyjecha...) Furthermore, if you apply for the legalization of your stay in Poland during the validity period of one of the above-mentioned entry and stay entitlements, and the application contains no formal deficiencies, your stay in Poland will also be considered legal until a final decision regarding residence permit is issued. Regardless of the entry and stay entitlement, possessing a valid passport is a necessary condition for legal stay in Poland.