- Prevent crash if non-existing save/serializer handler is tried to be used

- Added the registered serializers information to MINFO.
This commit is contained in:
foobar 2003-08-26 02:03:41 +00:00
parent e01eddf01d
commit 625600af30

View File

@ -92,17 +92,11 @@ static PHP_INI_MH(OnUpdateSaveHandler)
return FAILURE;
}
PS(mod) = _php_find_ps_module(new_value TSRMLS_CC);
/*
* Following lines are commented out to prevent bogus error message at
* start up. i.e. Save handler modules are not initilzied before Session
* module.
*/
#if 0
if(!PS(mod)) {
if (PG(modules_activated) && !PS(mod)) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot find save handler %s", new_value);
}
#endif
return SUCCESS;
}
@ -113,17 +107,11 @@ static PHP_INI_MH(OnUpdateSerializer)
return FAILURE;
}
PS(serializer) = _php_find_ps_serializer(new_value TSRMLS_CC);
/*
* Following lines are commented out to prevent bogus error message at
* start up. i.e. Serializer modules are not initilzied before Session
* module.
*/
#if 0
if(!PS(serializer)) {
if (PG(modules_activated) && !PS(serializer)) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot find serialization handler %s", new_value);
}
#endif
return SUCCESS;
}
@ -1749,26 +1737,46 @@ PHP_MSHUTDOWN_FUNCTION(session)
PHP_MINFO_FUNCTION(session)
{
ps_module **mod;
smart_str handlers = {0};
ps_serializer *ser;
smart_str save_handlers = {0};
smart_str ser_handlers = {0};
int i;
/* Get save handlers */
for (i = 0, mod = ps_modules; i < MAX_MODULES; i++, mod++) {
if (*mod && (*mod)->s_name) {
smart_str_appends(&handlers, (*mod)->s_name);
smart_str_appendc(&handlers, ' ');
smart_str_appends(&save_handlers, (*mod)->s_name);
smart_str_appendc(&save_handlers, ' ');
}
}
/* Get serializer handlers */
for (i = 0, ser = ps_serializers; i < MAX_SERIALIZERS; i++, ser++) {
if (ser && ser->name) {
smart_str_appends(&ser_handlers, ser->name);
smart_str_appendc(&ser_handlers, ' ');
}
}
php_info_print_table_start();
php_info_print_table_row(2, "Session Support", "enabled" );
if (handlers.c) {
smart_str_0(&handlers);
php_info_print_table_row(2, "Registered save handlers", handlers.c);
smart_str_free(&handlers);
if (save_handlers.c) {
smart_str_0(&save_handlers);
php_info_print_table_row(2, "Registered save handlers", save_handlers.c);
smart_str_free(&save_handlers);
} else {
php_info_print_table_row(2, "Registered save handlers", "none");
}
if (ser_handlers.c) {
smart_str_0(&ser_handlers);
php_info_print_table_row(2, "Registered serializer handlers", ser_handlers.c);
smart_str_free(&ser_handlers);
} else {
php_info_print_table_row(2, "Registered serializer handlers", "none");
}
php_info_print_table_end();
DISPLAY_INI_ENTRIES();