Browse Source

MF53: Sync the session.c file structure and some bug fixes forgotten to merge.

PHP-5.2.1RC1
Jani Taskinen 18 years ago
parent
commit
9f729f9c6b
  1. 22
      ext/session/php_session.h
  2. 1672
      ext/session/session.c
  3. 2
      ext/session/tests/008-php4.2.3.phpt
  4. 4
      ext/session/tests/014.phpt
  5. 20
      ext/session/tests/session_decode_variation3.phpt
  6. 28
      ext/session/tests/session_encode_error2.phpt
  7. 4
      ext/session/tests/session_encode_variation1.phpt
  8. 2
      ext/session/tests/session_encode_variation2.phpt
  9. 6
      ext/session/tests/session_encode_variation6.phpt
  10. 11
      ext/session/tests/session_encode_variation8.phpt

22
ext/session/php_session.h

@ -134,26 +134,6 @@ typedef php_ps_globals zend_ps_globals;
extern zend_module_entry session_module_entry;
#define phpext_session_ptr &session_module_entry
PHP_FUNCTION(session_name);
PHP_FUNCTION(session_module_name);
PHP_FUNCTION(session_save_path);
PHP_FUNCTION(session_id);
PHP_FUNCTION(session_regenerate_id);
PHP_FUNCTION(session_decode);
PHP_FUNCTION(session_register);
PHP_FUNCTION(session_unregister);
PHP_FUNCTION(session_is_registered);
PHP_FUNCTION(session_encode);
PHP_FUNCTION(session_start);
PHP_FUNCTION(session_destroy);
PHP_FUNCTION(session_unset);
PHP_FUNCTION(session_set_save_handler);
PHP_FUNCTION(session_cache_expire);
PHP_FUNCTION(session_cache_limiter);
PHP_FUNCTION(session_set_cookie_params);
PHP_FUNCTION(session_get_cookie_params);
PHP_FUNCTION(session_write_close);
#ifdef ZTS
#define PS(v) TSRMG(ps_globals_id, php_ps_globals *, v)
#else
@ -229,7 +209,7 @@ PHPAPI const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC);
(key_type = zend_hash_get_current_key_ex(_ht, &key, &key_length, &num_key, 0, NULL)) != HASH_KEY_NON_EXISTANT; \
zend_hash_move_forward(_ht)) { \
if (key_type == HASH_KEY_IS_LONG) { \
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Skipping numeric key %ld.", num_key); \
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Skipping numeric key %ld", num_key); \
continue; \
} \
key_length--; \

1672
ext/session/session.c
File diff suppressed because it is too large
View File

2
ext/session/tests/008-php4.2.3.phpt

@ -59,7 +59,7 @@ session_destroy();
?>
--EXPECTF--
NULL
session_write_close(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively.
session_write_close(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively
array(1) {
["c"]=>
float(3.14)

4
ext/session/tests/014.phpt

@ -35,8 +35,8 @@ session_destroy();
--EXPECTF--
<a href="/link?PHPSESSID=abtest">
Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time. in %s on line %d
Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line %d
<a href="/link?PHPSESSID=abtest">
Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time. in %s on line %d
Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line %d
<a href="/link?PHPSESSID=abtest">

20
ext/session/tests/session_decode_variation3.phpt

@ -23,8 +23,8 @@ $_SESSION["foo"] = 1234567890;
$_SESSION["bar"] = "Blah!";
$_SESSION["guff"] = 123.456;
var_dump($_SESSION);
$encoded = "A2Zvb2k6MTIzNDU2Nzg5MDs=";
var_dump(session_decode(base64_decode($encoded)));
$encoded = "foo|i:1234567890;";
var_dump(session_decode($encoded));
var_dump($_SESSION);
var_dump(session_destroy());
@ -34,10 +34,11 @@ ob_end_flush();
--EXPECTF--
*** Testing session_decode() : variation ***
Warning: session_start(): Unknown session.serialize_handler. Failed to decode session object. in %s on line %d
bool(true)
array(0) {
}
Warning: session_start(): Cannot find serialization handler 'blah' - session startup failed in %s on line %d
bool(false)
Notice: Undefined variable: _SESSION in %s on line %d
NULL
array(3) {
["foo"]=>
int(1234567890)
@ -47,7 +48,7 @@ array(3) {
float(123.456)
}
Warning: session_decode(): Unknown session.serialize_handler. Failed to decode session object. in %s on line %d
Warning: session_decode(): Unknown session.serialize_handler. Failed to decode session object in %s on line %d
bool(true)
array(3) {
["foo"]=>
@ -57,6 +58,7 @@ array(3) {
["guff"]=>
float(123.456)
}
bool(true)
Done
Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
bool(false)
Done

28
ext/session/tests/session_encode_error2.phpt

@ -100,63 +100,63 @@ ob_end_flush();
-- Iteration 1 --
bool(true)
Notice: session_encode(): Skipping numeric key 0. in %s on line %d
Notice: session_encode(): Skipping numeric key 0 in %s on line %d
bool(false)
bool(true)
-- Iteration 2 --
bool(true)
Notice: session_encode(): Skipping numeric key 1. in %s on line %d
Notice: session_encode(): Skipping numeric key 1 in %s on line %d
bool(false)
bool(true)
-- Iteration 3 --
bool(true)
Notice: session_encode(): Skipping numeric key 12345. in %s on line %d
Notice: session_encode(): Skipping numeric key 12345 in %s on line %d
bool(false)
bool(true)
-- Iteration 4 --
bool(true)
Notice: session_encode(): Skipping numeric key -2345. in %s on line %d
Notice: session_encode(): Skipping numeric key -2345 in %s on line %d
bool(false)
bool(true)
-- Iteration 5 --
bool(true)
Notice: session_encode(): Skipping numeric key 10. in %s on line %d
Notice: session_encode(): Skipping numeric key 10 in %s on line %d
bool(false)
bool(true)
-- Iteration 6 --
bool(true)
Notice: session_encode(): Skipping numeric key -10. in %s on line %d
Notice: session_encode(): Skipping numeric key -10 in %s on line %d
bool(false)
bool(true)
-- Iteration 7 --
bool(true)
Notice: session_encode(): Skipping numeric key %s. in %s on line %d
Notice: session_encode(): Skipping numeric key %s in %s on line %d
bool(false)
bool(true)
-- Iteration 8 --
bool(true)
Notice: session_encode(): Skipping numeric key 0. in %s on line %d
Notice: session_encode(): Skipping numeric key 0 in %s on line %d
bool(false)
bool(true)
-- Iteration 9 --
bool(true)
Notice: session_encode(): Skipping numeric key 0. in %s on line %d
Notice: session_encode(): Skipping numeric key 0 in %s on line %d
bool(false)
bool(true)
@ -173,28 +173,28 @@ bool(true)
-- Iteration 12 --
bool(true)
Notice: session_encode(): Skipping numeric key 1. in %s on line %d
Notice: session_encode(): Skipping numeric key 1 in %s on line %d
bool(false)
bool(true)
-- Iteration 13 --
bool(true)
Notice: session_encode(): Skipping numeric key 0. in %s on line %d
Notice: session_encode(): Skipping numeric key 0 in %s on line %d
bool(false)
bool(true)
-- Iteration 14 --
bool(true)
Notice: session_encode(): Skipping numeric key 1. in %s on line %d
Notice: session_encode(): Skipping numeric key 1 in %s on line %d
bool(false)
bool(true)
-- Iteration 15 --
bool(true)
Notice: session_encode(): Skipping numeric key 0. in %s on line %d
Notice: session_encode(): Skipping numeric key 0 in %s on line %d
bool(false)
bool(true)
@ -245,7 +245,7 @@ bool(true)
Strict Standards: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
Notice: session_encode(): Skipping numeric key %d. in %s on line %d
Notice: session_encode(): Skipping numeric key %d in %s on line %d
bool(false)
bool(true)
Done

4
ext/session/tests/session_encode_variation1.phpt

@ -31,7 +31,7 @@ ob_end_flush();
--EXPECTF--
*** Testing session_encode() : variation ***
Warning: session_encode(): Cannot encode non-existent session. in %s on line %d
Warning: session_encode(): Cannot encode non-existent session in %s on line %d
bool(false)
bool(true)
bool(false)
@ -41,7 +41,7 @@ bool(true)
bool(false)
bool(true)
Warning: session_encode(): Cannot encode non-existent session. in %s on line %d
Warning: session_encode(): Cannot encode non-existent session in %s on line %d
bool(false)
Done

2
ext/session/tests/session_encode_variation2.phpt

@ -29,7 +29,7 @@ ob_end_flush();
bool(false)
bool(true)
Warning: session_encode(): Cannot encode non-existent session. in %s on line %d
Warning: session_encode(): Cannot encode non-existent session in %s on line %d
bool(false)
Done

6
ext/session/tests/session_encode_variation6.phpt

@ -35,17 +35,17 @@ ob_end_flush();
*** Testing session_encode() : variation ***
bool(true)
Notice: session_encode(): Skipping numeric key 0. in %s on line %d
Notice: session_encode(): Skipping numeric key 0 in %s on line %d
bool(false)
bool(true)
bool(true)
Notice: session_encode(): Skipping numeric key 1234567890. in %s on line %d
Notice: session_encode(): Skipping numeric key 1234567890 in %s on line %d
bool(false)
bool(true)
bool(true)
Notice: session_encode(): Skipping numeric key -1234567890. in %s on line %d
Notice: session_encode(): Skipping numeric key -1234567890 in %s on line %d
bool(false)
bool(true)
Done

11
ext/session/tests/session_encode_variation8.phpt

@ -29,11 +29,12 @@ ob_end_flush();
--EXPECTF--
*** Testing session_encode() : variation ***
Warning: session_start(): Unknown session.serialize_handler. Failed to decode session object. in %s on line %d
bool(true)
Warning: session_start(): Cannot find serialization handler 'blah' - session startup failed in %s on line %d
bool(false)
Warning: session_encode(): Unknown session.serialize_handler. Failed to encode session object. in %s on line %d
Warning: session_encode(): Cannot encode non-existent session in %s on line %d
string(0) ""
bool(true)
Done
Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
bool(false)
Done
Loading…
Cancel
Save