1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
| | Submitted upstream as https://github.com/php/php-src/pull/10538.
From ee775be9af6fe4de7a5a1b6535cc6a319b87af90 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Tue, 7 Feb 2023 22:35:00 +0100
Subject: [PATCH] Fix streams copy length after partial copy_file_range.
---
main/streams/streams.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/main/streams/streams.c b/main/streams/streams.c
index 20029fc73e..34fd794136 100644
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -1626,6 +1626,9 @@ PHPAPI zend_result _php_stream_copy_to_stream_ex(php_stream *src, php_stream *de
}
#endif // HAVE_COPY_FILE_RANGE
+ // If we are falling back, remove read bytes from the total size to copy
+ maxlen -= haveread;
+
if (maxlen == PHP_STREAM_COPY_ALL) {
maxlen = 0;
}
--
2.38.1
|