php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #52982
Patch php-trunk-session-status-bools revision 2011-07-26 18:53 UTC by arpad@php.net
Patch php-trunk-session-status revision 2011-07-26 18:52 UTC by arpad@php.net
Patch session.c.patch.txt revision 2010-10-04 07:05 UTC by php dot net at kenman dot net
revision 2010-10-04 02:46 UTC by php dot net at kenman dot net

Patch php-trunk-session-status-bools for Session related Bug #52982

Patch version 2011-07-26 18:53 UTC

Return to Bug #52982 | Download this patch
This patch renders other patches obsolete

Obsolete patches:

Patch Revisions:

Developer: arpad@php.net

Index: ext/session/session.c
===================================================================
--- ext/session/session.c	(revision 313745)
+++ ext/session/session.c	(working copy)
@@ -1830,6 +1830,30 @@
 }
 /* }}} */
 
+/* {{{ proto bool session_is_active(void)
+   Returns whether the session is active */
+static PHP_FUNCTION(session_is_active)
+{
+	if (zend_parse_parameters_none() == FAILURE) {
+		return;
+	}
+
+	RETURN_BOOL(PS(session_status) == php_session_active);
+}
+/* }}} */
+
+/* {{{ proto bool session_is_available(void)
+   Returns whether the session is available */
+static PHP_FUNCTION(session_is_available)
+{
+	if (zend_parse_parameters_none() == FAILURE) {
+		return;
+	}
+
+	RETURN_BOOL(PS(session_status) != php_session_disabled);
+}
+/* }}} */
+
 /* {{{ arginfo */
 ZEND_BEGIN_ARG_INFO_EX(arginfo_session_name, 0, 0, 0)
 	ZEND_ARG_INFO(0, name)
@@ -1903,6 +1927,8 @@
 	PHP_FE(session_set_cookie_params, arginfo_session_set_cookie_params)
 	PHP_FE(session_get_cookie_params, arginfo_session_void)
 	PHP_FE(session_write_close,       arginfo_session_void)
+	PHP_FE(session_is_active,         arginfo_session_void)
+	PHP_FE(session_is_available,      arginfo_session_void)
 	PHP_FALIAS(session_commit, session_write_close, arginfo_session_void)
 	PHP_FE_END
 };
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC