]> granicus.if.org Git - php/commitdiff
reset ext/session to the state of 7.0.2
authorAnatol Belski <ab@php.net>
Fri, 29 Jan 2016 07:37:27 +0000 (08:37 +0100)
committerAnatol Belski <ab@php.net>
Fri, 29 Jan 2016 07:37:27 +0000 (08:37 +0100)
26 files changed:
ext/session/mod_user.c
ext/session/mod_user_class.c
ext/session/php_session.h
ext/session/session.c
ext/session/tests/016.phpt
ext/session/tests/bug55688.phpt
ext/session/tests/bug60634.phpt
ext/session/tests/bug60634_error_1.phpt
ext/session/tests/bug61728.phpt
ext/session/tests/bug67972.phpt
ext/session/tests/bug68063.phpt
ext/session/tests/bug69111.phpt [deleted file]
ext/session/tests/bug70133.phpt [deleted file]
ext/session/tests/bug71186.phpt [deleted file]
ext/session/tests/rfc1867_sid_invalid.phpt
ext/session/tests/session_save_path_variation2.phpt
ext/session/tests/session_save_path_variation3.phpt
ext/session/tests/session_set_save_handler_class_002.phpt
ext/session/tests/session_set_save_handler_class_005.phpt
ext/session/tests/session_set_save_handler_class_012.phpt
ext/session/tests/session_set_save_handler_class_016.phpt
ext/session/tests/session_set_save_handler_class_017.phpt
ext/session/tests/session_set_save_handler_error4.phpt
ext/session/tests/session_set_save_handler_iface_001.phpt
ext/session/tests/session_set_save_handler_iface_002.phpt
ext/session/tests/sessionhandler_open_001.phpt

index c7c09ff78116af2241e51945dcfb3b87d5f502aa..e6f162855a8188360375524f073902504b71a974 100644 (file)
@@ -85,16 +85,7 @@ PS_OPEN_FUNC(user)
        ZVAL_STRING(&args[0], (char*)save_path);
        ZVAL_STRING(&args[1], (char*)session_name);
 
-       zend_try {
-               ps_call_handler(&PSF(open), 2, args, &retval);
-       } zend_catch {
-               PS(session_status) = php_session_none;
-               if (!Z_ISUNDEF(retval)) {
-                       zval_ptr_dtor(&retval);
-               }
-               zend_bailout();
-       } zend_end_try();
-
+       ps_call_handler(&PSF(open), 2, args, &retval);
        PS(mod_user_implemented) = 1;
 
        FINISH;
index a774d4bf9c22caf852d844f791fd261d7873d28d..59b44f5f6f8f65d71a2fd9bc15841a95c1d5bcd6 100644 (file)
 #include "php_session.h"
 
 #define PS_SANITY_CHECK                                                \
-       if (PS(session_status) != php_session_active) { \
-               php_error_docref(NULL, E_WARNING, "Session is not active"); \
-               RETURN_FALSE; \
-       } \
        if (PS(default_mod) == NULL) {                          \
                php_error_docref(NULL, E_CORE_ERROR, "Cannot call default session handler"); \
                RETURN_FALSE;                                           \
@@ -44,7 +40,6 @@ PHP_METHOD(SessionHandler, open)
 {
        char *save_path = NULL, *session_name = NULL;
        size_t save_path_len, session_name_len;
-       int ret;
 
        PS_SANITY_CHECK;
 
@@ -53,15 +48,7 @@ PHP_METHOD(SessionHandler, open)
        }
 
        PS(mod_user_is_open) = 1;
-
-       zend_try {
-               ret = PS(default_mod)->s_open(&PS(mod_data), save_path, session_name);
-       } zend_catch {
-               PS(session_status) = php_session_none;
-               zend_bailout();
-       } zend_end_try();
-
-       RETVAL_BOOL(SUCCESS == ret);
+       RETVAL_BOOL(SUCCESS == PS(default_mod)->s_open(&PS(mod_data), save_path, session_name));
 }
 /* }}} */
 
@@ -69,8 +56,6 @@ PHP_METHOD(SessionHandler, open)
    Wraps the old close handler */
 PHP_METHOD(SessionHandler, close)
 {
-       int ret;
-
        PS_SANITY_CHECK_IS_OPEN;
 
        // don't return on failure, since not closing the default handler
@@ -78,15 +63,7 @@ PHP_METHOD(SessionHandler, close)
        zend_parse_parameters_none();
 
        PS(mod_user_is_open) = 0;
-
-       zend_try {
-               ret = PS(default_mod)->s_close(&PS(mod_data));
-       } zend_catch {
-               PS(session_status) = php_session_none;
-               zend_bailout();
-       } zend_end_try();
-
-       RETVAL_BOOL(SUCCESS == ret);
+       RETVAL_BOOL(SUCCESS == PS(default_mod)->s_close(&PS(mod_data)));
 }
 /* }}} */
 
index b2ddef901dd98cbc1eb0960cd570b5e8ba930da3..ccd9b2c8f0a7fc6c2ec8cd5897f81ef7bb8be0fb 100644 (file)
@@ -27,7 +27,7 @@
 # include "ext/hash/php_hash.h"
 #endif
 
-#define PHP_SESSION_API 20150121
+#define PHP_SESSION_API 20160121
 
 #include "php_version.h"
 #define PHP_SESSION_VERSION PHP_VERSION
index fc91eda00b07ed85af3174a343f4a4b017e69046..52ba7e300ab41e14f87672261ae46689ea2975f1 100644 (file)
@@ -97,13 +97,11 @@ zend_class_entry *php_session_update_timestamp_iface_entry;
 #define APPLY_TRANS_SID (PS(use_trans_sid) && !PS(use_only_cookies))
 
 static void php_session_send_cookie(void);
-static void php_session_abort(void);
 
 /* Dispatched by RINIT and by php_session_destroy */
 static inline void php_rinit_session_globals(void) /* {{{ */
 {
        /* Do NOT init PS(mod_user_names) here! */
-       /* TODO: These could be moved to MINIT and removed. These should be initialized by php_rshutdown_session_globals() always when execution is finished. */
        PS(id) = NULL;
        PS(session_status) = php_session_none;
        PS(mod_data) = NULL;
@@ -131,15 +129,10 @@ static inline void php_rshutdown_session_globals(void) /* {{{ */
                zend_string_release(PS(id));
                PS(id) = NULL;
        }
-
        if (PS(session_vars)) {
                zend_string_release(PS(session_vars));
                PS(session_vars) = NULL;
        }
-
-       /* User save handlers may end up directly here by misuse, bugs in user script, etc. */
-       /* Set session status to prevent error while restoring save handler INI value. */
-       PS(session_status) = php_session_none;
 }
 /* }}} */
 
@@ -510,10 +503,7 @@ static void php_session_initialize(void) /* {{{ */
 {
        zend_string *val = NULL;
 
-       PS(session_status) = php_session_active;
-
        if (!PS(mod)) {
-               PS(session_status) = php_session_disabled;
                php_error_docref(NULL, E_ERROR, "No storage module chosen - failed to initialize session");
                return;
        }
@@ -522,19 +512,14 @@ static void php_session_initialize(void) /* {{{ */
        if (PS(mod)->s_open(&PS(mod_data), PS(save_path), PS(session_name)) == FAILURE
                /* || PS(mod_data) == NULL */ /* FIXME: open must set valid PS(mod_data) with success */
        ) {
-               php_session_abort();
                php_error_docref(NULL, E_ERROR, "Failed to initialize storage module: %s (path: %s)", PS(mod)->s_name, PS(save_path));
                return;
        }
 
        /* If there is no ID, use session module to create one */
-       if (!PS(id) || !ZSTR_VAL(PS(id))[0]) {
-               if (PS(id)) {
-                       zend_string_release(PS(id));
-               }
+       if (!PS(id)) {
                PS(id) = PS(mod)->s_create_sid(&PS(mod_data));
                if (!PS(id)) {
-                       php_session_abort();
                        php_error_docref(NULL, E_ERROR, "Failed to create session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
                        return;
                }
@@ -556,6 +541,7 @@ static void php_session_initialize(void) /* {{{ */
        }
 
        php_session_reset_id();
+       PS(session_status) = php_session_active;
 
        /* GC must be done before read */
        php_session_gc();
@@ -563,11 +549,11 @@ static void php_session_initialize(void) /* {{{ */
        /* Read data */
        php_session_track_init();
        if (PS(mod)->s_read(&PS(mod_data), PS(id), &val, PS(gc_maxlifetime)) == FAILURE) {
-               php_session_abort();
                /* Some broken save handler implementation returns FAILURE for non-existent session ID */
                /* It's better to raise error for this, but disabled error for better compatibility */
-               php_error_docref(NULL, E_WARNING, "Failed to read session data: %s (path: %s)", PS(mod)->s_name, PS(save_path));
-               return;
+               /*
+               php_error_docref(NULL, E_NOTICE, "Failed to read session data: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+               */
        }
        if (PS(session_vars)) {
                zend_string_release(PS(session_vars));
@@ -1116,7 +1102,7 @@ static ps_serializer ps_serializers[MAX_SERIALIZERS + 1] = {
 
 PHPAPI int php_session_register_serializer(const char *name, zend_string *(*encode)(PS_SERIALIZER_ENCODE_ARGS), int (*decode)(PS_SERIALIZER_DECODE_ARGS)) /* {{{ */
 {
-       int ret = FAILURE;
+       int ret = -1;
        int i;
 
        for (i = 0; i < MAX_SERIALIZERS; i++) {
@@ -1125,7 +1111,7 @@ PHPAPI int php_session_register_serializer(const char *name, zend_string *(*enco
                        ps_serializers[i].encode = encode;
                        ps_serializers[i].decode = decode;
                        ps_serializers[i + 1].name = NULL;
-                       ret = SUCCESS;
+                       ret = 0;
                        break;
                }
        }
@@ -1147,13 +1133,13 @@ static ps_module *ps_modules[MAX_MODULES + 1] = {
 
 PHPAPI int php_session_register_module(ps_module *ptr) /* {{{ */
 {
-       int ret = FAILURE;
+       int ret = -1;
        int i;
 
        for (i = 0; i < MAX_MODULES; i++) {
                if (!ps_modules[i]) {
                        ps_modules[i] = ptr;
-                       ret = SUCCESS;
+                       ret = 0;
                        break;
                }
        }
@@ -1302,13 +1288,11 @@ static int php_session_cache_limiter(void) /* {{{ */
        php_session_cache_limiter_t *lim;
 
        if (PS(cache_limiter)[0] == '\0') return 0;
-       if (PS(session_status) != php_session_active) return -1;
 
        if (SG(headers_sent)) {
                const char *output_start_filename = php_output_get_start_filename();
                int output_start_lineno = php_output_get_start_lineno();
 
-               php_session_abort();
                if (output_start_filename) {
                        php_error_docref(NULL, E_WARNING, "Cannot send session cache limiter - headers already sent (output started at %s:%d)", output_start_filename, output_start_lineno);
                } else {
@@ -1668,8 +1652,8 @@ PHPAPI void php_session_start(void) /* {{{ */
 static void php_session_flush(int write) /* {{{ */
 {
        if (PS(session_status) == php_session_active) {
-               php_session_save_current_state(write);
                PS(session_status) = php_session_none;
+               php_session_save_current_state(write);
        }
 }
 /* }}} */
@@ -1677,10 +1661,10 @@ static void php_session_flush(int write) /* {{{ */
 static void php_session_abort(void) /* {{{ */
 {
        if (PS(session_status) == php_session_active) {
+               PS(session_status) = php_session_none;
                if (PS(mod_data) || PS(mod_user_implemented)) {
                        PS(mod)->s_close(&PS(mod_data));
                }
-               PS(session_status) = php_session_none;
        }
 }
 /* }}} */
@@ -2055,13 +2039,13 @@ static PHP_FUNCTION(session_regenerate_id)
                return;
        }
 
-       if (PS(session_status) != php_session_active) {
-               php_error_docref(NULL, E_WARNING, "Cannot regenerate session id - session is not active");
+       if (SG(headers_sent) && PS(use_cookies)) {
+               php_error_docref(NULL, E_WARNING, "Cannot regenerate session id - headers already sent");
                RETURN_FALSE;
        }
 
-       if (SG(headers_sent) && PS(use_cookies)) {
-               php_error_docref(NULL, E_WARNING, "Cannot regenerate session id - headers already sent");
+       if (PS(session_status) != php_session_active) {
+               php_error_docref(NULL, E_WARNING, "Cannot regenerate session id - session is not active");
                RETURN_FALSE;
        }
 
@@ -2113,7 +2097,6 @@ static PHP_FUNCTION(session_regenerate_id)
                zend_string_release(PS(id));
                PS(id) = PS(mod)->s_create_sid(&PS(mod_data));
                if (!PS(id)) {
-                       PS(mod)->s_close(&PS(mod_data));
                        PS(session_status) = php_session_none;
                        php_error_docref(NULL, E_RECOVERABLE_ERROR, "Failed to create session ID by collision: %s (path: %s)", PS(mod)->s_name, PS(save_path));
                        RETURN_FALSE;
@@ -2121,7 +2104,6 @@ static PHP_FUNCTION(session_regenerate_id)
        }
        /* Read is required to make new session data at this point. */
        if (PS(mod)->s_read(&PS(mod_data), PS(id), &data, PS(gc_maxlifetime)) == FAILURE) {
-               PS(mod)->s_close(&PS(mod_data));
                PS(session_status) = php_session_none;
                php_error_docref(NULL, E_RECOVERABLE_ERROR, "Failed to create(read) session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
                RETURN_FALSE;
@@ -2293,6 +2275,11 @@ static PHP_FUNCTION(session_start)
                RETURN_FALSE;
        }
 
+       if (PS(id) && !(ZSTR_LEN(PS(id)))) {
+               php_error_docref(NULL, E_WARNING, "Cannot start session with empty session ID");
+               RETURN_FALSE;
+       }
+
        /* set options */
        if (options) {
                ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(options), num_idx, str_idx, value) {
index f23605eb4794142d2f02e4eec325a0f3d7890616..82a85d270548d89b4402a67b030a90a6997c64fb 100644 (file)
@@ -22,5 +22,5 @@ session_write_close();
 print "I live\n";
 ?>
 --EXPECTF--
-Warning: session_start(): Failed to read session data: files (path: 123;:/really%scompletely:::/invalid;;,23123;213) in %s on line %d
+Warning: session_write_close(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (123;:/really%scompletely:::/invalid;;,23123;213) in %s on line %d
 I live
index b073dc3c5c64d8aa8f50d60e2ca2083e78562a75..8db48384af0c0b7defa110ce99cea95d96630486 100644 (file)
@@ -12,4 +12,4 @@ $x = new SessionHandler;
 $x->gc(1);
 ?>
 --EXPECTF--
-Warning: SessionHandler::gc(): Session is not active in %s on line %d
+Warning: SessionHandler::gc(): Parent session handler is not open in %s on line %d
index b2f507628729f5364e69dd443961baefac43d930..86dcb115268c410afc3c8a401c0bc60b22a1acc2 100644 (file)
@@ -39,17 +39,8 @@ session_start();
 session_write_close();
 echo "um, hi\n";
 
-/*
-FIXME: Since session module try to write/close session data in
-RSHUTDOWN, write() is executed twices. This is caused by undefined
-function error and zend_bailout(). Current session module codes
-depends on this behavior. These codes should be modified to remove
-multiple write().
-*/
-
 ?>
 --EXPECTF--
 write: goodbye cruel world
-write: goodbye cruel world
 close: goodbye cruel world
 
index fa76ff522a66f57dd12db6d2b41466f91b938ae1..d0733f5a5a72ad4933afb82f3d73ac2071ee0569 100644 (file)
@@ -41,11 +41,6 @@ session_start();
 session_write_close();
 echo "um, hi\n";
 
-/*
-FIXME: Something wrong. It should try to close after error, otherwise session
-may keep "open" state.
-*/
-
 ?>
 --EXPECTF--
 write: goodbye cruel world
@@ -56,4 +51,3 @@ Stack trace:
 #1 %s(%d): session_write_close()
 #2 {main}
   thrown in %s on line %d
-
index 2780d7b7e2ce03c58f59567ae9f1a9a31cf78e1a..3f8dbeb58ae7a93edd114320bfe13ec4531c0040 100644 (file)
@@ -8,34 +8,32 @@ function output_html($ext) {
     return strlen($ext);
 }
 
-function open ($save_path, $session_name) {
+function open ($save_path, $session_name) { 
     return true;
-}
+} 
 
-function close() {
+function close() { 
     return true;
-}
+} 
 
-function read ($id) {
-    return '';
-}
+function read ($id) { 
+} 
 
-function write ($id, $sess_data) {
+function write ($id, $sess_data) { 
     ob_start("output_html");
     echo "laruence";
     ob_end_flush();
     return true;
-}
+} 
 
-function destroy ($id) {
-    return true;
-}
+function destroy ($id) { 
+} 
 
-function gc ($maxlifetime) {
-    return true;
-}
+function gc ($maxlifetime) { 
+    return true; 
+} 
 
-session_set_save_handler ("open", "close", "read", "write", "destroy", "gc");
+session_set_save_handler ("open", "close", "read", "write", "destroy", "gc"); 
 session_start();
 --EXPECTF--
 8
index 92c3044ac599bf7df024001229266ec76b77694d..63ed3a95b8978df9a8daf24a7b9cea184019d03d 100644 (file)
@@ -7,5 +7,4 @@ Bug #67972: SessionHandler Invalid memory read create_sid()
 
 (new SessionHandler)->create_sid();
 --EXPECTF--
-Warning: SessionHandler::create_sid(): Session is not active in %s on line %d
-
+Fatal error: SessionHandler::create_sid(): Cannot call default session handler in %s on line %d
index ec3a70d156399b039f1bd4ce14e5b8c81604303c..d3da470d06d0a7df3f1fcafbbf4a4eb43358ab97 100644 (file)
@@ -3,22 +3,18 @@ Bug #68063 (Empty session IDs do still start sessions)
 --SKIPIF--
 <?php include('skipif.inc'); ?>
 --INI--
-session.use_strict_mode=0
-session.hash_function=1
-session.hash_bits_per_character=4
 --FILE--
 <?php
-// Empty session ID may happen by browser bugs
-
 // Could also be set with a cookie like "PHPSESSID=; path=/"
 session_id('');
 
-// Start the session with empty string should result in new session ID
+// Will still start the session and return true
 var_dump(session_start());
 
-// Returns newly created session ID
+// Returns an empty string
 var_dump(session_id());
 ?>
 --EXPECTF--
-bool(true)
-string(40) "%s"
+Warning: session_start(): Cannot start session with empty session ID in %s on line %d
+bool(false)
+string(0) ""
diff --git a/ext/session/tests/bug69111.phpt b/ext/session/tests/bug69111.phpt
deleted file mode 100644 (file)
index f5def0e..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Bug #69111 (Crash in SessionHandler::read())
---INI--
-session.save_path=
-session.save_handler=files
-session.name=PHPSESSID
---SKIPIF--
-<?php include('skipif.inc'); ?>
---FILE--
-<?php
-$sh = new SessionHandler;
-session_set_save_handler($sh);
-
-$savePath = ini_get('session.save_path');
-$sessionName = ini_get('session.name');
-
-// session_start(); // Uncommenting this makes it not crash when reading the session (see below), but it will not return any data.
-
-$sh->open($savePath, $sessionName);
-$sh->write("foo", "bar");
-$sh->read($id);
-$sh->gc(1245);
-$sh->close();
-?>
---EXPECTF--
-Warning: SessionHandler::open(): Session is not active in %s on line 10
-
-Warning: SessionHandler::write(): Session is not active in %s on line 11
-
-Notice: Undefined variable: id in %s on line 12
-
-Warning: SessionHandler::read(): Session is not active in %s on line 12
-
-Warning: SessionHandler::gc(): Session is not active in %s on line 13
-
-Warning: SessionHandler::close(): Session is not active in %s on line 14
\ No newline at end of file
diff --git a/ext/session/tests/bug70133.phpt b/ext/session/tests/bug70133.phpt
deleted file mode 100644 (file)
index 3e019e4..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
---TEST--
-Bug #70133 (Extended SessionHandler::read is ignoring $session_id when calling parent)
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.save_handler=files
-session.save_path=
-session.use_strict_mode=0
---FILE--
-<?php
-
-class CustomReadHandler extends \SessionHandler {
-
-    public function read($session_id) {
-        return parent::read('mycustomsession');
-    }
-}
-
-ob_start();
-
-session_set_save_handler(new CustomReadHandler(), true);
-
-session_id('mycustomsession');
-session_start();
-$_SESSION['foo'] = 'hoge';
-var_dump(session_id());
-session_commit();
-
-session_id('otherid');
-session_start();
-var_dump($_SESSION);
-var_dump(session_id());
-
-?>
---EXPECT--
-string(15) "mycustomsession"
-array(1) {
-  ["foo"]=>
-  string(4) "hoge"
-}
-string(7) "otherid"
diff --git a/ext/session/tests/bug71186.phpt b/ext/session/tests/bug71186.phpt
deleted file mode 100644 (file)
index 5eeba60..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-Bug #71186 session.hash_function - algorithm changes
---SKIPIF--
-<?php include('skipif.inc'); ?>
---INI--
-session.hash_function=sha512
-session.save_handler=files
---FILE--
-<?php
-ob_start();
-ini_set('session.use_strict_mode', 1);
-
-session_start();
-$orig = session_id();
-session_regenerate_id();
-$new = session_id();
-var_dump(strlen($orig),strlen($new));
-session_commit();
-
-ini_set('session.hash_function','sha1');
-session_id('invalid');
-session_start();
-$orig = session_id();
-session_regenerate_id();
-$new = session_id();
-var_dump(strlen($orig),strlen($new));
-?>
---EXPECT--
-int(128)
-int(128)
-int(40)
-int(40)
index a9114e3e1d5bd46f7f0d7d16439e0b77980d13cb..4dd8f1f9799236a7a9932e77f7f982fde2753a34 100644 (file)
@@ -47,13 +47,13 @@ session_destroy();
 --EXPECTF--
 Warning: Unknown: The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0
 
-Warning: Unknown: Failed to read session data: files (path: ) in Unknown on line 0
+Warning: Unknown: The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0
 
 Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0
 
 Warning: Unknown: The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0
 
-Warning: Unknown: Failed to read session data: files (path: ) in Unknown on line 0
+Warning: Unknown: The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0
 
 Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0
 string(%d) "%s"
index 60675aec3c84e1a718c494aef5a020315070956b..4cf44b75a443e594e329c34a1d4220cd2a0320da 100644 (file)
@@ -33,12 +33,8 @@ ob_end_flush();
 string(5) "/blah"
 
 Warning: session_start(): open(%sblah%e%s, O_RDWR) failed: No such file or directory (2) in %s on line %d
-
-Warning: session_start(): Failed to read session data: files (path: %sblah) in %s on line %d
-bool(false)
+bool(true)
 string(5) "/blah"
-
-Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
-bool(false)
+bool(true)
 string(5) "/blah"
 Done
index 1d290d95b33ebc8080a9891c169deefa2237060d..b064f30183dbf7a9fa2882650a53d10010a51bd1 100644 (file)
@@ -33,12 +33,8 @@ ob_end_flush();
 string(5) "/blah"
 
 Warning: session_start(): open(%s, O_RDWR) failed: No such file or directory (2) in %s on line %d
-
-Warning: session_start(): Failed to read session data: files (path: %sblah) in %s on line %d
-bool(false)
+bool(true)
 string(5) "/blah"
-
-Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
-bool(false)
+bool(true)
 string(5) "/blah"
 Done
index 880bc33425fdd70cad29901673a6342906d18d3e..b75a7e63908982b05d4fa4a22755291ac0feb57e 100644 (file)
@@ -34,7 +34,7 @@ class MySession2 extends SessionHandler {
        }
 
        public function read($id) {
-               return (string)@file_get_contents($this->path . $id);
+               return @file_get_contents($this->path . $id);
        }
 
        public function write($id, $data) {
index 1b8c1ce645ebdc2e4e8cd432df8ea5c8e94ffccc..5be735306ac6a8b6092c576afb788d8c5ed856c3 100644 (file)
@@ -33,7 +33,7 @@ class MySession6 extends SessionHandler {
 
 $handler = new MySession6;
 session_set_save_handler($handler);
-var_dump(session_start());
+session_start();
 
 var_dump(session_id(), ini_get('session.save_handler'), $_SESSION);
 
@@ -45,12 +45,13 @@ session_unset();
 *** Testing session_set_save_handler() : incomplete implementation ***
 
 Warning: SessionHandler::read(): Parent session handler is not open in %ssession_set_save_handler_class_005.php on line %d
-
-Warning: SessionHandler::close(): Parent session handler is not open in %ssession_set_save_handler_class_005.php on line %d
-
-Warning: session_start(): Failed to read session data: user (%s) in %ssession_set_save_handler_class_005.php on line %d
-bool(false)
 string(%d) "%s"
 string(4) "user"
 array(0) {
 }
+
+Warning: SessionHandler::write(): Parent session handler is not open in %ssession_set_save_handler_class_005.php on line %d
+
+Warning: session_write_close(): Failed to write session data %s in %ssession_set_save_handler_class_005.php on line %d
+
+Warning: SessionHandler::close(): Parent session handler is not open in %ssession_set_save_handler_class_005.php on line %d
index 0ce03f865e4c1716d7a2f8e8ffb625fa5012bc8c..91e751bdfc172a25d0cc46e24e35cd186f56cd64 100644 (file)
@@ -38,7 +38,7 @@ class MySession extends SessionHandler {
 $oldHandler = ini_get('session.save_handler');
 $handler = new MySession;
 session_set_save_handler($handler);
-var_dump(session_start());
+session_start();
 
 var_dump(session_id(), $oldHandler, ini_get('session.save_handler'), $handler->i, $_SESSION);
 
@@ -50,14 +50,15 @@ Warning: SessionHandler::open() expects exactly 2 parameters, 0 given in %s on l
 Read %s
 
 Warning: SessionHandler::read(): Parent session handler is not open in %s on line %d
-
-Warning: SessionHandler::close(): Parent session handler is not open in %s on line %d
-
-Warning: session_start(): Failed to read session data: user (%s) in %s on line %d
-bool(false)
 string(%d) "%s"
 string(5) "files"
 string(4) "user"
 int(2)
 array(0) {
 }
+
+Warning: SessionHandler::write(): Parent session handler is not open in Unknown on line 0
+
+Warning: session_write_close(): Failed to write session data %s in %s on line %d
+
+Warning: SessionHandler::close(): Parent session handler is not open in Unknown on line 0
index 4095813c9d8d2e9d74091807c98ab27d257a17b2..521bd86f31845380106f39291ceb5aa131eaa175 100644 (file)
@@ -10,10 +10,10 @@ session.name=PHPSESSID
 
 ob_start();
 
-/*
+/* 
  * Prototype : bool session_set_save_handler(SessionHandlerInterface $handler [, bool $register_shutdown_function = true])
  * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
+ * Source code : ext/session/session.c 
  */
 
 echo "*** Testing session_set_save_handler() function: class with create_sid ***\n";
@@ -34,7 +34,7 @@ class MySession2 extends SessionHandler {
        }
 
        public function read($id) {
-               return (string)@file_get_contents($this->path . $id);
+               return @file_get_contents($this->path . $id);
        }
 
        public function write($id, $data) {
index b8e7d7a7ad0033a40dbafba5d59e5552e1bea589..6f42d7809adec51455ee9179a233ebae3d681022 100644 (file)
@@ -34,7 +34,7 @@ class MySession2 extends SessionHandler {
        }
 
        public function read($id) {
-               return (string)@file_get_contents($this->path . $id);
+               return @file_get_contents($this->path . $id);
        }
 
        public function write($id, $data) {
index 4267195ee15e2d15a2b58fe515e9afce6f18e4f9..be3429b084240b864f7246e09c32d96c7826f0d6 100644 (file)
@@ -24,7 +24,7 @@ session_set_save_handler("callback", "callback", "callback", "echo", "callback",
 session_set_save_handler("callback", "callback", "callback", "callback", "echo", "callback");
 session_set_save_handler("callback", "callback", "callback", "callback", "callback", "echo");
 session_set_save_handler("callback", "callback", "callback", "callback", "callback", "callback");
-var_dump(session_start());
+session_start();
 ob_end_flush();
 ?>
 --EXPECTF--
@@ -39,6 +39,3 @@ Warning: session_set_save_handler(): Argument 4 is not a valid callback in %s on
 Warning: session_set_save_handler(): Argument 5 is not a valid callback in %s on line %d
 
 Warning: session_set_save_handler(): Argument 6 is not a valid callback in %s on line %d
-
-Warning: session_start(): Failed to read session data: user (%s) in %s on line %d
-bool(false)
index 6943d59cbec931a17de650a43ca0b65fd1811a67..03ee42865c093cb425dbc67fa5511ebbb9a99056 100644 (file)
@@ -34,7 +34,7 @@ class MySession2 implements SessionHandlerInterface {
        }
 
        public function read($id) {
-               return (string)@file_get_contents($this->path . $id);
+               return @file_get_contents($this->path . $id);
        }
 
        public function write($id, $data) {
index 204d88c785bb19c816575e80e490a651f76687dc..40c9ac68257969ad63d641df412be43cd9313263 100644 (file)
@@ -43,7 +43,7 @@ class MySession2 implements MySessionHandlerInterface {
        }
 
        public function read($id) {
-               return (string)@file_get_contents($this->path . $id);
+               return @file_get_contents($this->path . $id);
        }
 
        public function write($id, $data) {
index e6e913a6a5735db97e66743b119e80c5df432561..6ade9e00a598e973f630d83288cb7fd155511cda 100644 (file)
@@ -16,11 +16,4 @@ print "Done!\n";
 
 ?>
 --EXPECTF--
-Warning: SessionHandler::open(): Session is not active in %s on line 5
-
-Warning: SessionHandler::open(): Session is not active in %s on line 6
-
-Warning: SessionHandler::open(): Session is not active in %s on line 7
-
-Warning: SessionHandler::open(): Session is not active in %s on line 8
 Done!