Skip to content

Commit 87c2f5b

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Fix phpGH-9949: Partial content on incomplete POST request
2 parents a839230 + aef7d81 commit 87c2f5b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ PHP NEWS
1212
. Fixed potentially undefined behavior in Windows ftok(3) emulation. (cmb)
1313
. Fixed GH-9769 (Misleading error message for unpacking of objects). (jhdxr)
1414

15+
- Apache:
16+
. Fixed bug GH-9949 (Partial content on incomplete POST request). (cmb)
17+
1518
- FPM:
1619
. Fixed bug GH-9959 (Solaris port event mechanism is still broken after bug
1720
#66694). (Petr Sumbera)

sapi/apache2handler/sapi_apache2.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ php_apache_sapi_read_post(char *buf, size_t count_bytes)
182182
php_struct *ctx = SG(server_context);
183183
request_rec *r;
184184
apr_bucket_brigade *brigade;
185+
apr_status_t status;
185186

186187
r = ctx->r;
187188
brigade = ctx->brigade;
@@ -193,7 +194,7 @@ php_apache_sapi_read_post(char *buf, size_t count_bytes)
193194
* need to make sure that if data is available we fill the buffer completely.
194195
*/
195196

196-
while (ap_get_brigade(r->input_filters, brigade, AP_MODE_READBYTES, APR_BLOCK_READ, len) == APR_SUCCESS) {
197+
while ((status = ap_get_brigade(r->input_filters, brigade, AP_MODE_READBYTES, APR_BLOCK_READ, len)) == APR_SUCCESS) {
197198
apr_brigade_flatten(brigade, buf, &len);
198199
apr_brigade_cleanup(brigade);
199200
tlen += len;
@@ -204,6 +205,10 @@ php_apache_sapi_read_post(char *buf, size_t count_bytes)
204205
len = count_bytes - tlen;
205206
}
206207

208+
if (status != APR_SUCCESS) {
209+
return 0;
210+
}
211+
207212
return tlen;
208213
}
209214

0 commit comments

Comments
 (0)