From 8d6cc00cbdcf4a571246019170eb8bf8818bc86e Mon Sep 17 00:00:00 2001 From: Joe Watkins Date: Mon, 17 Oct 2016 14:42:35 +0100 Subject: [PATCH 1/4] Merge branch 'pull-request/2158' --- TSRM/threads.m4 | 54 ++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/TSRM/threads.m4 b/TSRM/threads.m4 index 38494ce7cae..7ef920231ca 100644 --- a/TSRM/threads.m4 +++ b/TSRM/threads.m4 @@ -66,9 +66,10 @@ dnl dnl Check whether the current setup can use POSIX threads calls dnl AC_DEFUN([PTHREADS_CHECK_COMPILE], [ -AC_TRY_RUN( [ +AC_TRY_LINK( [ #include #include + ], [ void *thread_routine(void *data) { return data; @@ -81,17 +82,10 @@ int main() { pthread_mutexattr_init(&mattr); return pthread_create(&thd, NULL, thread_routine, &data); } ], [ - pthreads_working=yes + pthreads_checked=yes ], [ - pthreads_working=no - ], [ - dnl For cross compiling running this test is of no use. NetWare supports pthreads - pthreads_working=no - case $host_alias in - *netware*) - pthreads_working=yes - esac -] + pthreads_checked=no + ] ) ] )dnl dnl dnl PTHREADS_CHECK() @@ -129,30 +123,34 @@ else CFLAGS="$CFLAGS $flag" PTHREADS_CHECK_COMPILE CFLAGS=$ac_save - if test "$pthreads_working" = "yes"; then + if test "$pthreads_checked" = "yes"; then ac_cv_pthreads_cflags=$flag break fi done fi -fi -]) + ]) -AC_CACHE_CHECK(for pthreads_lib, ac_cv_pthreads_lib,[ -ac_cv_pthreads_lib= -if test "$pthreads_working" != "yes"; then - for lib in pthread pthreads c_r; do - ac_save=$LIBS - LIBS="$LIBS -l$lib" - PTHREADS_CHECK_COMPILE - LIBS=$ac_save - if test "$pthreads_working" = "yes"; then - ac_cv_pthreads_lib=$lib - break - fi - done + AC_CACHE_CHECK(for pthreads_lib, ac_cv_pthreads_lib,[ + ac_cv_pthreads_lib= + if test "$pthreads_working" != "yes"; then + for lib in pthread pthreads c_r; do + ac_save=$LIBS + LIBS="$LIBS -l$lib" + PTHREADS_CHECK_COMPILE + LIBS=$ac_save + if test "$pthreads_checked" = "yes"; then + ac_cv_pthreads_lib=$lib + break + fi + done + fi + ]) + + if test "x$ac_cv_pthreads_cflags" != "x" -o "x$ac_cv_pthreads_lib" != "x"; then + pthreads_working="yes" + fi fi -]) if test "$pthreads_working" = "yes"; then threads_result="POSIX-Threads found" From bd6bce888a426b2d8af44f7145e5107cdedb8841 Mon Sep 17 00:00:00 2001 From: Joe Watkins Date: Mon, 17 Oct 2016 15:50:59 +0100 Subject: [PATCH 2/4] news entry for pr #2158 --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index e5049b515de..d3a002880d7 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,7 @@ PHP NEWS . Fixed bug #66862 ((Sub-)Namespaces unexpected behaviour). (Nikita) . Fixed bug #73067 (__debugInfo crashes when throwing an exception). (Laruence) + . Fix pthreads detection when cross-compiling (ffontaine) - GD: . Fixed bug #73213 (Integer overflow in imageline() with antialiasing). (cmb) From 96ed946b2b0301489419d1b0321f9a94e35b3abc Mon Sep 17 00:00:00 2001 From: Joe Watkins Date: Mon, 17 Oct 2016 15:59:51 +0100 Subject: [PATCH 3/4] Merge branch 'pull-request/2097' --- sapi/fpm/fpm/fpm_request.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sapi/fpm/fpm/fpm_request.c b/sapi/fpm/fpm/fpm_request.c index ec8601b4787..3f82a7d4f75 100644 --- a/sapi/fpm/fpm/fpm_request.c +++ b/sapi/fpm/fpm/fpm_request.c @@ -262,8 +262,9 @@ void fpm_request_check_timed_out(struct fpm_child_s *child, struct timeval *now, fpm_trace_signal(child->pid); - zlog(ZLOG_WARNING, "[pool %s] child %d, script '%s' (request: \"%s %s\") executing too slow (%d.%06d sec), logging", + zlog(ZLOG_WARNING, "[pool %s] child %d, script '%s' (request: \"%s %s%s%s\") executing too slow (%d.%06d sec), logging", child->wp->config->name, (int) child->pid, purified_script_filename, proc.request_method, proc.request_uri, + (proc.query_string[0] ? "?" : ""), proc.query_string, (int) tv.tv_sec, (int) tv.tv_usec); } else @@ -272,8 +273,9 @@ void fpm_request_check_timed_out(struct fpm_child_s *child, struct timeval *now, str_purify_filename(purified_script_filename, proc.script_filename, sizeof(proc.script_filename)); fpm_pctl_kill(child->pid, FPM_PCTL_TERM); - zlog(ZLOG_WARNING, "[pool %s] child %d, script '%s' (request: \"%s %s\") execution timed out (%d.%06d sec), terminating", + zlog(ZLOG_WARNING, "[pool %s] child %d, script '%s' (request: \"%s %s%s%s\") execution timed out (%d.%06d sec), terminating", child->wp->config->name, (int) child->pid, purified_script_filename, proc.request_method, proc.request_uri, + (proc.query_string[0] ? "?" : ""), proc.query_string, (int) tv.tv_sec, (int) tv.tv_usec); } } From 9594e364ed49d575dc27b887a996af10d18577ce Mon Sep 17 00:00:00 2001 From: Andrey Hristov Date: Mon, 17 Oct 2016 18:58:14 +0300 Subject: [PATCH 4/4] This is a very very old thing dated back to year 2009. MYSQL_OPT_READ_TIMEOUT was never a macro in mysqlnd but an enum value. So this never actually worked correctly. mysqlnd provides these so it is safe to have them when mysqlnd used. --- ext/mysqli/mysqli_api.c | 4 ++-- ext/mysqlnd/mysqlnd.c | 2 -- ext/mysqlnd/mysqlnd_net.c | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 4f66069e418..b8068201b1e 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -1759,14 +1759,14 @@ static int mysqli_options_get_option_zval_type(int option) #ifdef MYSQL_OPT_PROTOCOL case MYSQL_OPT_PROTOCOL: #endif /* MySQL 4.1.0 */ -#ifdef MYSQL_OPT_READ_TIMEOUT +#if MYSQL_VERSION_ID > 40101 || defined(MYSQLI_USE_MYSQLND) case MYSQL_OPT_READ_TIMEOUT: case MYSQL_OPT_WRITE_TIMEOUT: case MYSQL_OPT_GUESS_CONNECTION: case MYSQL_OPT_USE_EMBEDDED_CONNECTION: case MYSQL_OPT_USE_REMOTE_CONNECTION: case MYSQL_SECURE_AUTH: -#endif /* MySQL 4.1.1 */ +#endif #ifdef MYSQL_OPT_RECONNECT case MYSQL_OPT_RECONNECT: #endif /* MySQL 5.0.13 */ diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index 4c8f27f70c5..4290f9edaa3 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -2333,10 +2333,8 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_client_option)(MYSQLND_CONN_DATA * const c } switch (option) { case MYSQL_OPT_COMPRESS: -#ifdef WHEN_SUPPORTED_BY_MYSQLI case MYSQL_OPT_READ_TIMEOUT: case MYSQL_OPT_WRITE_TIMEOUT: -#endif case MYSQLND_OPT_SSL_KEY: case MYSQLND_OPT_SSL_CERT: case MYSQLND_OPT_SSL_CA: diff --git a/ext/mysqlnd/mysqlnd_net.c b/ext/mysqlnd/mysqlnd_net.c index 0fa67107e67..8ede6424b9f 100644 --- a/ext/mysqlnd/mysqlnd_net.c +++ b/ext/mysqlnd/mysqlnd_net.c @@ -820,13 +820,13 @@ MYSQLND_METHOD(mysqlnd_net, set_client_option)(MYSQLND_NET * const net, enum mys break; } case MYSQL_OPT_READ_TIMEOUT: + DBG_INF("MYSQL_OPT_READ_TIMEOUT"); net->data->options.timeout_read = *(unsigned int*) value; break; -#ifdef WHEN_SUPPORTED_BY_MYSQLI case MYSQL_OPT_WRITE_TIMEOUT: + DBG_INF("MYSQL_OPT_WRITE_TIMEOUT"); net->data->options.timeout_write = *(unsigned int*) value; break; -#endif case MYSQL_OPT_COMPRESS: net->data->options.flags |= MYSQLND_NET_FLAG_USE_COMPRESSION; break;