At 05:52 24.02.2003, Mr Percival said:
--------------------[snip]--------------------
>According to the PHP manual session_start always returns true.
>
>Ther are times (like when there is a disk full error on the server) that the 
>sesison_start will fail because its unable to write the session tmp file.
>
>So shouldnt session_start be able to return false if the file write fails?
>
>Or does it return false but the manual doesnt say so?
--------------------[snip]-------------------- 

session_start() just prepares for session use:
- check for an existing session ID (cookie or request parameter
- if found, retrieve stored session data
- else generate new session key
- check garbage collection (gc_probability)

There's nothing that it does to prepare to write the session file, this is
done when your script exits.

BTW, having a look at the implementation in ext/session/session.c, the
function is declared returning void:
     PHPAPI void php_session_start(TSRMLS_D)

The actual "return" value being stored in register AX (at least on Intel
platforms) it is most unlikely that ax contains a zero value. The last
statements at function end are:

    if (PS(mod_data) && PS(gc_probability) > 0) {
        int nrdels = -1;
        nrand = (int) (100.0*php_combined_lcg(TSRMLS_C));
        if (nrand < PS(gc_probability)) {
            PS(mod)->gc(&PS(mod_data), PS(gc_maxlifetime), &nrdels TSRMLS_CC);
        }
    }

PS(mod_data): returns a pointer to internal data structures, not zero.
PS(gc_probability): usually 1.
nrand: seldom zero value.
Result: Will return false if (and only if) the garbage collector routine
(gc) returns false.

But anyway this has only academic value since php_session_start() is
declared to return void - this should be stated correctly in the manual IMHO.


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to