I have a slight clarification. In my testing with php56u and your test code, I do get a time out:
$ time php ssl_bug.php Connected to ssl://imap.ikmj.com:993 * OK ikmj-serwer.home.pl IdeaImapServer v0.80 ready 1 CAPABILITY 2 LOGOUT
real 0m30.737s user 0m0.013s sys 0m0.009s
I assume you will reach the time out if you wait long enough.
I have also discovered that your test script works fine when using a different IMAP server:
$ php ssl_bug_different_server.php Connected to ssl://<redacted>:993 * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot ready. 1 CAPABILITY * CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN 2 LOGOUT
I have a slight clarification. In my testing with php56u and your test code, I do get a time out:
$ time php ssl_bug.php ikmj.com: 993
Connected to ssl://imap.
* OK ikmj-serwer.home.pl IdeaImapServer v0.80 ready
1 CAPABILITY
2 LOGOUT
real 0m30.737s
user 0m0.013s
sys 0m0.009s
I assume you will reach the time out if you wait long enough.
I have also discovered that your test script works fine when using a different IMAP server:
$ php ssl_bug_ different_ server. php redacted> :993
Connected to ssl://<
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot ready.
1 CAPABILITY
* CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN
2 LOGOUT