php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31966 SSL:// wrapper does not obey NON_BLOCKING mode.
Submitted: 2005-02-14 11:15 UTC Modified: 2005-02-14 20:19 UTC
From: james-php at bytehosting dot com Assigned:
Status: Closed Package: *Network Functions
PHP Version: 4.3.10 OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: james-php at bytehosting dot com
New email:
PHP Version: OS:

 

 [2005-02-14 11:15 UTC] james-php at bytehosting dot com
Description:
------------
When php is compiled against openssl. If you use a non_blocking stream PHP does not obet the non_blocking options. If you REMOVE the ssl:// and connect to a non-secure port, and it works perfectly fine.


OpenSSL 0.9.7e

PHP 4.3.10 (cgi-fcgi) (built: Dec 27 2004 04:01:15)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
Kernel: 2.4.22-36mdkenterprise
Mandrake Linux release 9.2 (FiveStar) for i586

Dual xeon + hyperthreading:
model name      : Intel(R) Xeon(TM) CPU 2.40GHz
stepping        : 9
cpu MHz         : 2389.117
cache size      : 512 KB


./configure  --enable-fastcgi --with-mysql --enable-aspell --enable-ftp --enable-xml --enable-trans-sid --enable-curl \
--enable-force-cgi-redirect --with-gd --with-zlib-dir --with-curl=/usr/include/curl --with-openssl \
--with-openssl-dir=/usr/compile/openssl-0.9.7e


Reproduce code:
---------------
<?

$fd = fsockopen("ssl://server.com","5557");
set_stream_blocking($fd,FALSE);

$buff = fgets($fd);

echo "You will never see this, as fgets hangs forever.";
?>

Expected result:
----------------
Socket to be non-blocked, and return immediately.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-14 11:20 UTC] james-php at bytehosting dot com
opps -- stream_set_blocking()

~james
 [2005-02-14 11:23 UTC] james-php at bytehosting dot com
Too late of night, the previous comment was ment to say (I made an error when submitting the bug). I do have it properly set as stream_set_blocking($fd,FALSE); and the problem still exists. The code sample submitted was wrong, the bug applies when you actully use the proper function names. Thats what I get when re-typing the code out in the form, instead of pasting it.

~james
 [2005-02-14 20:19 UTC] wez@php.net
Should already be fixed in PHP 5.1.
While it could be ported back to PHP 5.0 without much effort (if I haven't already merged it), back-porting to PHP 4.3 will be a bit more difficult.
I don't have plans to do that at this time.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jan 05 05:01:28 2025 UTC