Skip to content

Commit 750f87c

Browse files
author
Alexander Feldman
committed
Merged the patch of the buffering patch as it fixes a pretty major bug.
1 parent 86c5460 commit 750f87c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

ext/standard/file.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ PHP_FUNCTION(fgets)
919919
/* needed because recv doesnt put a null at the end*/
920920
memset(buf,0,len+1);
921921
#ifdef HAVE_FLUSHIO
922-
if (!issock) {
922+
if (type == le_fopen) {
923923
fseek((FILE*)what, 0, SEEK_CUR);
924924
}
925925
#endif
@@ -967,7 +967,7 @@ PHP_FUNCTION(fgetc) {
967967
}
968968

969969
#ifdef HAVE_FLUSHIO
970-
if (!issock) {
970+
if (type == le_fopen) {
971971
fseek((FILE*)what, 0, SEEK_CUR);
972972
}
973973
#endif
@@ -1170,7 +1170,9 @@ PHP_FUNCTION(fwrite)
11701170
ret = SOCK_WRITEL((*arg2)->value.str.val,num_bytes,socketd);
11711171
} else {
11721172
#ifdef HAVE_FLUSHIO
1173-
fseek((FILE*)what, 0, SEEK_CUR);
1173+
if (type == le_fopen) {
1174+
fseek((FILE*)what, 0, SEEK_CUR);
1175+
}
11741176
#endif
11751177
ret = fwrite((*arg2)->value.str.val,1,num_bytes,(FILE*)what);
11761178
}
@@ -1812,7 +1814,9 @@ PHP_FUNCTION(fread)
18121814

18131815
if (!issock) {
18141816
#ifdef HAVE_FLUSHIO
1815-
fseek((FILE*)what, 0, SEEK_CUR);
1817+
if (type == le_fopen) {
1818+
fseek((FILE*)what, 0, SEEK_CUR);
1819+
}
18161820
#endif
18171821
return_value->value.str.len = fread(return_value->value.str.val, 1, len, (FILE*)what);
18181822
return_value->value.str.val[return_value->value.str.len] = 0;

0 commit comments

Comments
 (0)