cvs: /php4/ext/session session.c

From: Date: Tue, 22 Feb 2000 14:44:59 +0000
Subject: cvs: /php4/ext/session session.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-10637@lists.php.net to get a copy of this message
sas Tue Feb 22 06:44:59 2000 EDT Modified files: /php4/ext/session session.c Log: Print out a warning, if writing the session data failed. This might happen in a request shutdown handler; php_error() worked for me in the CGI version. Index: php4/ext/session/session.c diff -u php4/ext/session/session.c:1.107 php4/ext/session/session.c:1.108 --- php4/ext/session/session.c:1.107 Tue Feb 22 06:23:09 2000 +++ php4/ext/session/session.c Tue Feb 22 06:44:29 2000 @@ -417,7 +417,7 @@ int vallen; if (PS(mod)->open(&PS(mod_data), PS(save_path), PS(session_name)) == FAILURE) { - php_error(E_ERROR, "failed to initialize session module"); + php_error(E_ERROR, "Failed to initialize session module"); return; } if (PS(mod)->read(&PS(mod_data), PS(id), &val, &vallen) == SUCCESS) { @@ -430,14 +430,20 @@ { char *val; int vallen; + int ret; val = _php_session_encode(&vallen PSLS_CC); if (val) { - PS(mod)->write(&PS(mod_data), PS(id), val, vallen); + ret = PS(mod)->write(&PS(mod_data), PS(id), val, vallen); efree(val); - } else { - PS(mod)->write(&PS(mod_data), PS(id), "", 0); - } + } else + ret = PS(mod)->write(&PS(mod_data), PS(id), "", 0); + + if (ret == FAILURE) + php_error(E_WARNING, "Failed to write session data. Please check that " + "the current setting of session.save_path is correct (%s)", + PS(save_path)); + PS(mod)->close(&PS(mod_data)); } @@ -840,7 +846,7 @@ old = estrdup(PS(session_name)); - if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE) + if (ac != 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE) WRONG_PARAM_COUNT; if (ac == 1) { @@ -864,7 +870,7 @@ old = estrdup(PS(mod)->name); - if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE) + if (ac != 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE) WRONG_PARAM_COUNT; if (ac == 1) { @@ -929,7 +935,7 @@ old = estrdup(PS(save_path)); - if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE) + if (ac != 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE) WRONG_PARAM_COUNT; if (ac == 1) { @@ -954,7 +960,7 @@ if (PS(id)) old = estrdup(PS(id)); - if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE) + if (ac != 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE) WRONG_PARAM_COUNT; if (ac == 1) {

« previous php.version4 (#10637) next »