From:
Operating system: Debian Squeeze
PHP version: 5.3.6
Package: OpenSSL related
Bug Type: Bug
Bug description:Failure in socket open to some SSL server
Description:
------------
fsockopen() connect to a server always failed. After some tests it is
confirmed due to a bug in a SSL function call which only occur in new
version:
5.2.6 - passed
5.2.17 - passed
5.3.0 - passed
5.3.1 - passed
5.3.2 - failed
5.3.3 - failed
5.3.6 - failed
The bug was introduced from svn revision #291493 "merge from trunk: openssl
sni support" from the function call to
SSL_set_tlsext_host_name(sslsock->ssl_handle, sslsock->sni).
If I remark this function, everything works fine.
I have no further idea what is this function do, and what side effect
without this function. Please advice and hope a fix would be available.
Thank you.
Test script:
---------------
<?
$fp = fsockopen("ssl://smtpb.scig.gov.hk", 465, $errno, $errstr, 30);
if (!$fp) {
echo "fail: $errstr ($errno)\n";
} else {
echo "success";
}
?>
Expected result:
----------------
$fp is a non-zero handle, the screen will show "success"
Actual result:
--------------
$fp is EMPTY, the screen will show:
Warning: fsockopen() [function.fsockopen]: SSL operation failed with code
1. OpenSSL Error messages: error:14094417:SSL
routines:func(148):reason(1047) in /www/test.php on line 2
Warning: fsockopen() [function.fsockopen]: Failed to enable crypto in
/www/test.php on line 2
Warning: fsockopen() [function.fsockopen]: unable to connect to
ssl://smtpb.scig.gov.hk:465 (Unknown error) in /www/test.php on line 2
fail: 0
--
Edit bug report at http://bugs.php.net/bug.php?id=54511&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=54511&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=54511&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=54511&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=54511&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=54511&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=54511&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=54511&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=54511&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=54511&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=54511&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=54511&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=54511&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=54511&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=54511&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54511&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54511&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=54511&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=54511&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=54511&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=54511&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=54511&r=mysqlcfg