summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/basic_functions.c57
-rw-r--r--ext/standard/basic_functions.h5
2 files changed, 62 insertions, 0 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 1f0c0611b2..9af58daa60 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -335,6 +335,11 @@ function_entry basic_functions[] = {
PHP_FE(array_keys, NULL)
PHP_FE(array_values, NULL)
+ PHP_FE(connection_aborted, NULL)
+ PHP_FE(connection_timeout, NULL)
+ PHP_FE(connection_status, NULL)
+ PHP_FE(ignore_user_abort, NULL)
+
{NULL, NULL, NULL}
};
@@ -2337,6 +2342,58 @@ PHP_FUNCTION(defined)
}
}
+/* {{{ proto int connection_aborted(void)
+ Returns true if client disconnected */
+PHP_FUNCTION(connection_aborted)
+{
+ RETURN_LONG(PG(connection_status)&PHP_CONNECTION_ABORTED);
+}
+/* }}} */
+
+/* {{{ proto int connection_timeout(void)
+ Returns true if script timed out */
+PHP_FUNCTION(connection_timeout)
+{
+
+ RETURN_LONG(PG(connection_status)&PHP_CONNECTION_TIMEOUT);
+}
+/* }}} */
+
+/* {{{ proto int connection_status(void)
+ Returns the connection status bitfield */
+PHP_FUNCTION(connection_status)
+{
+
+ RETURN_LONG(PG(connection_status));
+}
+/* }}} */
+
+/* {{{ proto int ignore_user_abort(boolean value)
+ Set whether we want to ignore a user abort event or not */
+PHP_FUNCTION(ignore_user_abort)
+{
+ pval *arg;
+ int old_setting;
+
+ old_setting = PG(ignore_user_abort);
+ switch (ARG_COUNT(ht)) {
+ case 0:
+ break;
+ case 1:
+ if (getParameters(ht,1,&arg) == FAILURE) {
+ RETURN_FALSE;
+ }
+ convert_to_long(arg);
+ PG(ignore_user_abort)=arg->value.lval;
+ break;
+ default:
+ WRONG_PARAM_COUNT;
+ break;
+ }
+ RETURN_LONG(old_setting);
+}
+/* }}} */
+
/* {{{ proto bool function_exists(string function_name)
Checks if a given function has been defined */
PHP_FUNCTION(function_exists)
diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h
index 20d88ca478..cfd502e4de 100644
--- a/ext/standard/basic_functions.h
+++ b/ext/standard/basic_functions.h
@@ -123,6 +123,11 @@ PHP_FUNCTION(print_r);
PHP_FUNCTION(define);
PHP_FUNCTION(defined);
+PHP_FUNCTION(connection_aborted);
+PHP_FUNCTION(connection_timeout);
+PHP_FUNCTION(connection_status);
+PHP_FUNCTION(ignore_user_abort);
+
PHP_FUNCTION(function_exists);
PHP_FUNCTION(in_array);
PHP_FUNCTION(extract);