Skip to content

Commit 1ea8c82

Browse files
committed
Make test for bug #51056 (blocking read) more reliable
It seems that it might sometimes not return the last 0 bytes on Windows because it likely signals EOF before that. We do not really need to check it so only non 0 lines are printed.
1 parent b8d013a commit 1ea8c82

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

ext/standard/tests/streams/bug51056.phpt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@ phpt_wait();
2525
2626
$fp = fsockopen("tcp://127.0.0.1:64324");
2727
28-
while(!feof($fp)) {
29-
$data = fread($fp, 256);
30-
printf("fread read %d bytes\n", strlen($data));
28+
while (!feof($fp)) {
29+
$data = fread($fp, 256);
30+
$bytes = strlen($data);
31+
if ($bytes > 0) {
32+
printf("fread read %d bytes\n", $bytes);
33+
}
3134
}
3235
CODE;
3336

@@ -40,4 +43,3 @@ fread read 8 bytes
4043
fread read 256 bytes
4144
fread read 45 bytes
4245
fread read 8 bytes
43-
fread read 0 bytes

0 commit comments

Comments
 (0)