]> granicus.if.org Git - php/commitdiff
Fix couple of crashes on error conditions
authorStanislav Malyshev <stas@php.net>
Sun, 2 Jul 2000 16:27:39 +0000 (16:27 +0000)
committerStanislav Malyshev <stas@php.net>
Sun, 2 Jul 2000 16:27:39 +0000 (16:27 +0000)
Make session_module_name really work

ext/session/session.c

index 4d9b990bc2e128d05cd77f285ab6332ece8e87e0..0d634f240e1d2f10631b34518dd784cf95c014a8 100644 (file)
@@ -75,6 +75,9 @@ static PHP_INI_MH(OnUpdateSaveHandler)
        PSLS_FETCH();
        
        PS(mod) = _php_find_ps_module(new_value PSLS_CC);
+       if(!PS(mod)) {
+         php_error(E_ERROR,"Can't find save handler %s",new_value);
+       }
        return SUCCESS;
 }
 
@@ -84,6 +87,9 @@ static PHP_INI_MH(OnUpdateSerializer)
        PSLS_FETCH();
 
        PS(serializer) = _php_find_ps_serializer(new_value PSLS_CC);
+       if(!PS(serializer)) {
+         php_error(E_ERROR,"Can't find serializer handler %s",new_value);
+       }         
        return SUCCESS;
 }
 
@@ -481,6 +487,10 @@ static void _php_session_save_current_state(PSLS_D)
        ulong num_key;
        PLS_FETCH();
        
+       if(!PS(http_session_vars)) {
+         return;
+       }
+
        if (!PG(register_globals)) {
                for (zend_hash_internal_pointer_reset(PS(http_session_vars)->value.ht);
                         zend_hash_get_current_key(PS(http_session_vars)->value.ht, &variable, &num_key) == HASH_KEY_IS_STRING;
@@ -979,7 +989,8 @@ PHP_FUNCTION(session_module_name)
                if (tempmod) {
                        if (PS(mod_data))
                                PS(mod)->close(&PS(mod_data));
-                       PS(mod_data) = tempmod;
+                       PS(mod) = tempmod;
+                       PS(mod_data) = NULL;
                } else {
                        efree(old);
                        php_error(E_ERROR, "Cannot find named PHP session module (%s)",