Bug #75538 [Opn->Fbk]: stream_set_blocking() always returning false for files on windows

From: Date: Mon, 20 Nov 2017 19:36:48 +0000
Subject: Bug #75538 [Opn->Fbk]: stream_set_blocking() always returning false for files on windows
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-212650@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75538&edit=1

 ID:                 75538
 Updated by:         ab@php.net
 Reported by:        samuel dot chemla at orange dot com
 Summary:            stream_set_blocking() always returning false for
                     files on windows
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            Streams related
 Operating System:   Windows
 PHP Version:        7.1.11
 Block user comment: N
 Private report:     N

 New Comment:

Thanks for the report. Could you give an extended example in PHP on the topic you've mentioned?

Thanks


Previous Comments:
------------------------------------------------------------------------
[2017-11-19 16:39:27] samuel dot chemla at orange dot com

Description:
------------
Tested on PHP 5.6, PHP 7.0.24 & PHP 7.1.11.

stream_set_blocking() return always false for files (used with fopen()) on windows.
It seems to work on linux.

This is related to an old bug marked as "not a bug", but I prefered opening this new one.
https://bugs.php.net/bug.php?id=50856
Is this really not a bug? If so, then the doc shoud be updated to clarify why.

IMHO this is a bug because non blocking local file streams is a desired feature, even on windows.
Use case: dealing with multiple files reading and/or writing in parallel

Test script:
---------------
$fileRes = fopen("foo.txt", 'wb');
if ($fileRes === false) {
    throw new Exception();
}
var_dump(stream_set_blocking($fileRes, 0));

Expected result:
----------------
bool(true)

Actual result:
--------------
bool(false)


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=75538&edit=1


Thread (13 messages)

« previous php.bugs (#212650) next »