cvs: php4 /ext/session mod_files.c session.c
| From: | Sascha Schumann | Date: | Wed, 05 Jul 2000 01:26:23 +0000 |
| Subject: | cvs: php4 /ext/session mod_files.c session.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-622@lists.php.net to get a copy of this message | ||
sas Tue Jul 4 18:26:23 2000 EDT
Modified files:
/php4/ext/session mod_files.c session.c
Log:
(PHP session_destroy) return the error condition from storage handler's
session_destroy method.
Submitted by: juhl@eisenstein.dk
Index: php4/ext/session/mod_files.c
diff -u php4/ext/session/mod_files.c:1.36 php4/ext/session/mod_files.c:1.37
--- php4/ext/session/mod_files.c:1.36 Sun Jun 4 15:00:17 2000
+++ php4/ext/session/mod_files.c Tue Jul 4 18:26:22 2000
@@ -275,7 +275,9 @@
if (!_ps_files_path_create(buf, sizeof(buf), data, key))
return FAILURE;
- V_UNLINK(buf);
+ if (V_UNLINK(buf) == -1) {
+ return FAILURE;
+ }
return SUCCESS;
}
Index: php4/ext/session/session.c
diff -u php4/ext/session/session.c:1.151 php4/ext/session/session.c:1.152
--- php4/ext/session/session.c:1.151 Sun Jul 2 09:27:39 2000
+++ php4/ext/session/session.c Tue Jul 4 18:26:22 2000
@@ -138,7 +138,7 @@
static void php_rinit_session_globals(PSLS_D);
static void php_rshutdown_session_globals(PSLS_D);
-static void _php_session_destroy(PSLS_D);
+static zend_bool _php_session_destroy(PSLS_D);
zend_module_entry session_module_entry = {
"session",
@@ -874,18 +874,24 @@
}
}
-static void _php_session_destroy(PSLS_D)
+static zend_bool _php_session_destroy(PSLS_D)
{
+ zend_bool retval = SUCCESS;
+
if (PS(nr_open_sessions) == 0) {
php_error(E_WARNING, "Trying to destroy uninitialized session");
- return;
+ return FAILURE;
}
if (PS(mod)->destroy(&PS(mod_data), PS(id)) == FAILURE) {
+ retval = FAILURE;
php_error(E_WARNING, "Destroying the session object failed");
}
+
php_rshutdown_session_globals(PSLS_C);
php_rinit_session_globals(PSLS_C);
+
+ return retval;
}
@@ -1224,13 +1230,17 @@
}
/* }}} */
-/* {{{ proto void session_destroy(void)
+/* {{{ proto bool session_destroy(void)
Destroy the current session and all data associated with it */
PHP_FUNCTION(session_destroy)
{
PSLS_FETCH();
-
- _php_session_destroy(PSLS_C);
+
+ if (_php_session_destroy(PSLS_C) == SUCCESS) {
+ RETURN_TRUE;
+ } else {
+ RETURN_FALSE;
+ }
}
/* }}} */