@allvoxman I have installed php 8.0 from the same repository and can repeat the problem.
It looks to be a mistake in some new code in the imap extension for php 8 that validates the flags parameter, the fourth parameter. It has what looks to be incorrect validation of CL_EXPUNGE.
If you remove that parameter or use one of the others, such as OP_DEBUG then the imap_open will work.
@michiel Michiel, I think that you were doing some changes for php 8. Are you able to run the processbounces page in that environment?