This prevents it getting stuck in the on position.
if (data->fd >= 0) {
ret = read(data->fd, buf, count);
- if (ret == 0 || (ret == -1 && errno != EWOULDBLOCK))
- stream->eof = 1;
+ stream->eof = (ret == 0 || (ret == -1 && errno != EWOULDBLOCK));
} else {
#if HAVE_FLUSHIO
ret = fread(buf, 1, count, data->file);
- if (feof(data->file))
- stream->eof = 1;
+ stream->eof = feof(data->file);
}
return ret;
}
nr_bytes = recv(sock->socket, buf, count, 0);
- if (nr_bytes == 0 || (nr_bytes == -1 && php_socket_errno() != EWOULDBLOCK)) {
- stream->eof = 1;
- }
+ stream->eof = (nr_bytes == 0 || (nr_bytes == -1 && php_socket_errno() != EWOULDBLOCK));
if (nr_bytes > 0) {
php_stream_notify_progress_increment(stream->context, nr_bytes, 0);