com php-src: Merge branch 'PHP-7.0' into PHP-7.1: Zend/zend_e xecute_API.c Zend/zend_portability.h sapi/fpm/fpm/f pm_log.c sapi/fpm/fpm/fpm_main.c
sapi/fpm/fpm/fpm _signals.c sapi/phpdbg/phpdbg.h
| From: | Nikita Popov | Date: | Sun, 20 Nov 2016 18:10:03 +0000 |
| Subject: | com php-src: Merge branch 'PHP-7.0' into PHP-7.1: Zend/zend_e xecute_API.c Zend/zend_portability.h sapi/fpm/fpm/f pm_log.c sapi/fpm/fpm/fpm_main.c sapi/fpm/fpm/fpm _signals.c sapi/phpdbg/phpdbg.h |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95904@lists.php.net to get a copy of this message | ||
Commit: c58378619b34b1a15fbbf5500095d9ca99e59e90
Author: Nikita Popov <nikic@php.net> Sun, 20 Nov 2016 19:10:03 +0100
Parents: b7fee22e73f403acba9e7c1fff12c23f51139a75 ff5a65d26b139142c5e967582c369ef65b79adf8
Branches: PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c58378619b34b1a15fbbf5500095d9ca99e59e90
Log:
Merge branch 'PHP-7.0' into PHP-7.1
Changed paths:
MM Zend/zend_execute_API.c
MM Zend/zend_portability.h
MM sapi/fpm/fpm/fpm_log.c
MM sapi/fpm/fpm/fpm_main.c
MM sapi/fpm/fpm/fpm_signals.c
MM sapi/phpdbg/phpdbg.h
Diff:
diff --cc Zend/zend_execute_API.c
index 95b7af0,f96cac5..cba929a
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@@ -1146,66 -1181,8 +1146,66 @@@ ZEND_API int zend_eval_string_ex(char *
}
/* }}} */
-ZEND_API void zend_timeout(int dummy) /* {{{ */
+static void zend_set_timeout_ex(zend_long seconds, int reset_signals);
+
+ZEND_API ZEND_NORETURN void zend_timeout(int dummy) /* {{{ */
{
+#if defined(PHP_WIN32)
+# ifndef ZTS
+ /* No action is needed if we're timed out because zero seconds are
+ just ignored. Also, the hard timeout needs to be respected. If the
+ timer is not restarted properly, it could hang in the shutdown
+ function. */
+ if (EG(hard_timeout) > 0) {
+ EG(timed_out) = 0;
+ zend_set_timeout_ex(EG(hard_timeout), 1);
+ /* XXX Abused, introduce an additional flag if the value needs to be kept. */
+ EG(hard_timeout) = 0;
+ }
+# endif
+#else
+ EG(timed_out) = 0;
+ zend_set_timeout_ex(0, 1);
+#endif
+
+ zend_error_noreturn(E_ERROR, "Maximum execution time of " ZEND_LONG_FMT " second%s
exceeded", EG(timeout_seconds), EG(timeout_seconds) == 1 ? "" : "s");
+}
+/* }}} */
+
+#ifndef ZEND_WIN32
+static void zend_timeout_handler(int dummy) /* {{{ */
+{
+#ifndef ZTS
+ if (EG(timed_out)) {
+ /* Die on hard timeout */
+ const char *error_filename = NULL;
+ uint error_lineno = 0;
+ char log_buffer[2048];
+ int output_len = 0;
+
+ if (zend_is_compiling()) {
+ error_filename = ZSTR_VAL(zend_get_compiled_filename());
+ error_lineno = zend_get_compiled_lineno();
+ } else if (zend_is_executing()) {
+ error_filename = zend_get_executed_filename();
+ if (error_filename[0] == '[') { /* [no active file] */
+ error_filename = NULL;
+ error_lineno = 0;
+ } else {
+ error_lineno = zend_get_executed_lineno();
+ }
+ }
+ if (!error_filename) {
+ error_filename = "Unknown";
+ }
+
+ output_len = snprintf(log_buffer, sizeof(log_buffer), "\nFatal error: Maximum execution
time of " ZEND_LONG_FMT "+" ZEND_LONG_FMT " seconds exceeded (terminated) in %s
on line %d\n", EG(timeout_seconds), EG(hard_timeout), error_filename, error_lineno);
+ if (output_len > 0) {
- quiet_write(2, log_buffer, MIN(output_len, sizeof(log_buffer)));
++ write(2, log_buffer, MIN(output_len, sizeof(log_buffer)));
+ }
+ _exit(1);
+ }
+#endif
if (zend_on_timeout) {
#ifdef ZEND_SIGNALS