- Fixed bug #36185 (str_rot13() crash on non-string parameter). (Pierre)
- Fixed bug #36176 (PDO_PGSQL - PDO::exec() does not return number of rows
affected by the operation). (Ilia)
+- Fixed bug #36158 (SIGTERM is not handled correctly when running as a FastCGI
+ server). (Dmitry)
- Fixed bug #36152 (problems with curl+ssl and pgsql+ssl in same PHP). (Mike)
- Fixed bug #36148 (unpack("H*hex", $data) is adding an extra character to the
end of the string). (Ilia)
#ifndef PHP_WIN32
!parent &&
#endif
- (!request || FCGX_FFlush(request->out) == -1)) {
+ request && FCGX_FFlush(request->out) == -1) {
php_handle_aborted_connection();
}
return;
#ifdef DEBUG_FASTCGI
fprintf(stderr, "Wait for kids, pid %d\n", getpid());
#endif
- wait(&status);
+ while (wait(&status) < 0) {
+ }
running--;
}
}
exit_status = 255;
} zend_end_try();
+ SG(server_context) = NULL;
php_module_shutdown(TSRMLS_C);
sapi_shutdown();
static void fcgi_signal_handler(int signo)
{
- if (signo == SIGUSR1) {
+ if (signo == SIGUSR1 || signo == SIGTERM) {
in_shutdown = 1;
}
}
new_sa.sa_flags = 0;
new_sa.sa_handler = fcgi_signal_handler;
sigaction(SIGUSR1, &new_sa, NULL);
+ sigaction(SIGTERM, &new_sa, NULL);
sigaction(SIGPIPE, NULL, &old_sa);
if (old_sa.sa_handler == SIG_DFL) {
sigaction(SIGPIPE, &new_sa, NULL);
while (1) {
if (req->fd < 0) {
while (1) {
+ if (in_shutdown) {
+ return -1;
+ }
#ifdef _WIN32
HANDLE pipe = (HANDLE)_get_osfhandle(req->listen_socket);
OVERLAPPED ov;
FCGI_UNLOCK(req->listen_socket);
#endif
- if (in_shutdown || (req->fd < 0 && errno != EINTR)) {
+ if (req->fd < 0 && (in_shutdown || errno != EINTR)) {
return -1;
}
}
#endif
}
+ } else if (in_shutdown) {
+ return -1;
}
if (fcgi_read_request(req)) {
return req->fd;