|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15430 socket_set_blocking doesn't work
Submitted: 2002-02-07 09:43 UTC Modified: 2002-06-18 19:18 UTC
Avg. Score:4.8 ± 0.4
Reproduced:7 of 8 (87.5%)
Same Version:7 (100.0%)
Same OS:5 (71.4%)
From: armageddon at raydan dot de Assigned:
Status: Closed Package: Sockets related
PHP Version: 4.1.1 OS: Windows 2000
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: armageddon at raydan dot de
New email:
PHP Version: OS:


 [2002-02-07 09:43 UTC] armageddon at raydan dot de
I'm using Apache1.3.22/PHP4.1.1 on Windows 2000.

When I use socket_set_blocking($fp, FALSE); PHP doesn't read any more data from the socket:

do {
  if ($ch=fgetc($fp))
    echo dechex(ord($ch))." ";
  if ($ch==chr(0x2A)) {
} while (1);

This does work with socket blocking enabled but with socket blocking disabled I don't get any more data in my PHP-Script !


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-14 08:09 UTC] ruehl at igd dot fhg dot de
I have currently the same problem with PHP 4.1.1. However, when I put the sleep(1) statement IN FRONT of the fgets() or fgetc(), my code works even with non-blocking sockets (it's annoying but it works). Maybe this helps you for now (until this bug has been fixed).
 [2002-04-06 15:05 UTC] armageddon at raydan dot de

This doesn't work for me :-(
I still don't get any date when I use non-blocking sockets...
 [2002-06-08 06:44 UTC] bool at boolsite dot net
It's work for me, but it leaks memory... :o(

The problem is analysed actually... :o)
 [2002-06-08 06:55 UTC]
Wierd duplicate of
 [2002-06-08 07:10 UTC] armageddon at raydan dot de
Why "Duplicate" ? The other report is about a memory leak and mine is about PHP doesn't read data from the socket when using non-blocking sockets.
 [2002-06-18 19:18 UTC]
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at In case this was a documentation 
problem, the fix will show up soon at
In case this was a website problem, the change will show
up on the site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.

 [2002-07-21 15:13 UTC] on4kst at skynet dot be
In despite of this bug is closed the socket_set_blocking($fp, FALSE) function does not work as reported by Tested on Windows XP / Apache / PHP 4.0.6 and PHP 4.2.0. Used with fsockopen and fgets the behaviour in correct when the value is set to TRUE. When FALSE, a fgets() function always returns an empty string EVEN IF A DATA IS PENDING. In other words fgets() stops to read data.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Aug 13 12:03:34 2022 UTC