Skip to content

Commit 8c2d917

Browse files
committed
Also Fixed #68571 in CGI SAPI, and some cleanup
1 parent 6c87372 commit 8c2d917

File tree

6 files changed

+17
-9
lines changed

6 files changed

+17
-9
lines changed

NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 2015, PHP 5.5.22
44

5+
56
- Date:
67
. Fixed bug #45081 (strtotime incorrectly interprets SGT time zone). (Derick)
78
. Fixed bug #55407 (Impossible to prototype DateTime::createFromFormat).
@@ -13,6 +14,10 @@ PHP NEWS
1314
- Fileinfo:
1415
. Fixed bug #68827 (Double free with disabled ZMM). (Joshua Rogers)
1516

17+
- FPM:
18+
. Fixed bug #68571 (core dump when webserver close the socket).
19+
(redfoxli069 at gmail dot com, Laruence)
20+
1621
- OpenSSL:
1722
. Fixed bug #55618 (use case-insensitive cert name matching).
1823
(Daniel Lowrey)

sapi/cgi/cgi_main.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,13 +730,16 @@ static void sapi_cgi_log_message(char *message TSRMLS_DC)
730730

731731
request = (fcgi_request*) SG(server_context);
732732
if (request) {
733-
int len = strlen(message);
733+
int ret, len = strlen(message);
734734
char *buf = malloc(len+2);
735735

736736
memcpy(buf, message, len);
737737
memcpy(buf + len, "\n", sizeof("\n"));
738-
fcgi_write(request, FCGI_STDERR, buf, len+1);
738+
ret = fcgi_write(request, FCGI_STDERR, buf, len + 1);
739739
free(buf);
740+
if (ret < 0) {
741+
php_handle_aborted_connection();
742+
}
740743
} else {
741744
fprintf(stderr, "%s\n", message);
742745
}

sapi/cgi/fastcgi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,7 @@ int fcgi_flush(fcgi_request *req, int close)
13211321

13221322
if (safe_write(req, req->out_buf, len) != len) {
13231323
req->keep = 0;
1324+
req->out_pos = req->out_buf;
13241325
return 0;
13251326
}
13261327

sapi/fpm/fpm/fastcgi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ int fcgi_flush(fcgi_request *req, int close)
975975

976976
if (safe_write(req, req->out_buf, len) != len) {
977977
req->keep = 0;
978-
req->out_pos = req->out_buf;
978+
req->out_pos = req->out_buf;
979979
return 0;
980980
}
981981

sapi/fpm/fpm/fpm_main.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -669,15 +669,15 @@ void sapi_cgi_log_fastcgi(int level, char *message, size_t len)
669669
* - the message is not empty
670670
*/
671671
if (CGIG(fcgi_logging) && request && message && len > 0) {
672+
int ret;
672673
char *buf = malloc(len + 2);
673-
ssize_t ret = 0;
674674
memcpy(buf, message, len);
675675
memcpy(buf + len, "\n", sizeof("\n"));
676-
ret = fcgi_write(request, FCGI_STDERR, buf, len+1);
676+
ret = fcgi_write(request, FCGI_STDERR, buf, len + 1);
677677
free(buf);
678-
if (ret <= 0) {
679-
php_handle_aborted_connection();
680-
}
678+
if (ret < 0) {
679+
php_handle_aborted_connection();
680+
}
681681
}
682682
}
683683
/* }}} */

sapi/tests/test006.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ Content-Type: application/octet-stream
4343
phpinfo();
4444
?>
4545
-----------------------------240723202011929--
46-
4746
--FILE--
4847
<?php
4948
error_reporting(0);

0 commit comments

Comments
 (0)