After some head scratching I stumbled on a workaround for making the php-imap package compile again (PR/29962). I couldn’t have deployed a new version of PHP without the IMAP extension, yet an upgrade was needed due to denial-of-service vulnerabilities (CAN-2005-0524 and CAN-2005-0525).