FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » session_start() should return FALSE but does not
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
session_start() should return FALSE but does not [message #170292] Wed, 27 October 2010 07:49 Go to previous message
Rene[1] is currently offline  Rene[1]
Messages: 2
Registered: October 2010
Karma:
Junior Member
Hi,

I have played around with session_start() and found in the php manual,
that session_start() returns FALSE when php failed to start the
session (in php >= 5.3.0). So I took a php6dev (quite old from March)
and wrote the following script:

<?php
if (version_compare(phpversion(), '5.3.0') >= 0) {
if (session_start() == TRUE) {
echo "Session successfully started\n";
echo $_SESSION['check'] . "\n<br>";

$_SESSION['check'] = "Session works";
}
else
echo "Session could not be started!\<br>";
}
phpinfo();
?>

This script should return "session works" when the script is loaded
the second time. This works fine. Then I added a space in the first
line to trigger an error. This is what I got:

Warning: session_start() [function.session-start]: Cannot send session
cookie - headers already sent by (output started at ******/
test.php6:2) in /******/test.php6 on line 4

Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at ******/
test.php6:2) in ******/test.php6 on line 4
Session successfully started

A reload does not lead to the message "Session works" so I assume that
the session has not been created successfully although session_start()
returns TRUE. Unfortunately, this old version of php6 is the only one
that I have available that is >=5.3.0. Is that fixed in later
versions? Does it work as expected in 5.3.0? Am I wrong somewhere?

Rene
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Study Abroad Scholarship For Study in Australia...
Next Topic: Biosphere Technology -
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 20:24:40 GMT 2024

Total time taken to generate the page: 0.07057 seconds