I am also able to recreate this issue with php56u:
$ php -v
PHP 5.6.9 (cli) (built: May 15 2015 13:54:40)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
$ time php ssl_bug.php
Connected to ssl://imap.ikmj.com:993
* OK ikmj.home.pl IdeaImapServer v0.80 ready
1 CAPABILITY
2 LOGOUT
real 1m2.457s
user 0m0.012s
sys 0m0.008s
I still think this issue is tied with the cipher used in your certificate. Your certificate is using RC4-SHA and it appears that PHP is disabling all RC4 ciphers[0]. I have tested with a few different IMAP server that used ciphers on that list and did not run into any issues. You might want to try a test using a certificate with a ciphers on that list.
Hello Ralf,
I am also able to recreate this issue with php56u:
$ php -v
PHP 5.6.9 (cli) (built: May 15 2015 13:54:40)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
$ time php ssl_bug.php ikmj.com: 993
Connected to ssl://imap.
* OK ikmj.home.pl IdeaImapServer v0.80 ready
1 CAPABILITY
2 LOGOUT
real 1m2.457s
user 0m0.012s
sys 0m0.008s
I still think this issue is tied with the cipher used in your certificate. Your certificate is using RC4-SHA and it appears that PHP is disabling all RC4 ciphers[0]. I have tested with a few different IMAP server that used ciphers on that list and did not run into any issues. You might want to try a test using a certificate with a ciphers on that list.
-Ben
[0] https:/ /github. com/php/ php-src/ blob/master/ ext/openssl/ php_openssl. h#L39-L45