summaryrefslogtreecommitdiff
path: root/Zend/zend_execute_API.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2016-06-05 11:38:12 +0200
committerAnatol Belski <ab@php.net>2016-06-06 08:41:07 +0200
commit52ebd5611f5c9ff233f9cce16ec17b4560832af7 (patch)
treec5e014e7ac4f3619ac9aa89ef9cfe5bddcd94e3d /Zend/zend_execute_API.c
parentdb68121da8e92f91dbda1df8445a650f9f24329f (diff)
downloadphp-git-52ebd5611f5c9ff233f9cce16ec17b4560832af7.tar.gz
fix hard_timeout support in shutdown functions
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r--Zend/zend_execute_API.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index dba10e3564..05ee781bd6 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -1157,8 +1157,22 @@ 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)
+ /* 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;
+ }
+#else
EG(timed_out) = 0;
zend_set_timeout_ex(0, 1);
+#endif
+
zend_error_noreturn(E_ERROR, "Maximum execution time of %pd second%s exceeded", EG(timeout_seconds), EG(timeout_seconds) == 1 ? "" : "s");
}
/* }}} */