ID: 8772
User Update by: [EMAIL PROTECTED]
Status: Open
Bug Type: *Session related
Description: user level session storage fails when register_globals off

P.S.

Whith register_globals on, this works fine.

session_register("myvar");
$myvar = "VarVar";
exit;

and $myvar gets registerd with its value by the handler just
fine.

Serge

Previous Comments:
---------------------------------------------------------------------------

[2001-01-25 14:02:23] [EMAIL PROTECTED]
OK, here is some more info....

I just installed the Zend IDE and did some debugging.

What I noticed was the following using this test code:

<?php
    session_register("myvar");  
    $HTTP_SESSION_VARS['myvar'] = "VarVar";
    print "This is a test";
    exit;
?>

if register_globals is off (Note: setting this in a virtual server with  php_flag 
register_globals off)

session_register("myvar") calls open_session in my session handler, and then calls 
read_session in the handler
I assign a value to $HTTP_SESSION_VARS['myvar']
upon exit; the following happens
close_session is called in the session handler and thats the end! ---> write_session 
was never called?

####

if register_globals is on (Note: setting this in a virtual server with  php_flag 
register_globals on)

session_register("myvar") calls open_session in session handler, and then calls 
read_session in the handler.
I assign a value to $HTTP_SESSION_VARS['myvar']
upon exit; write_session is called and the value passed is 
!myvar| <---- missing the value of $myvar.
close_session is called and thats that.

Questions:

In the first example, why is write_session never called?
In the second example, why does !myvar| NOT have the value I assigned to it like so 
$HTTP_SESSION_VARS['myvar'] = "VarVar";


Thanks, Serge


---------------------------------------------------------------------------

[2001-01-23 17:50:54] [EMAIL PROTECTED]
What I have noticed is when I have register_globals on and I run this script, a record 
is added to the session table as expected.

<?php
    session_register("test");
    $HTTP_SESSION_VARS['test'] = "blabla";
?>

but when I have register_globals off and run this script, upon script completion there 
is NO session record in the table at all?

Serge


---------------------------------------------------------------------------

[2001-01-23 17:13:10] [EMAIL PROTECTED]
Still does not work. As stated before, when I check the database, the data field is 
empty.

phpinfo.php
<?php
    session_register("test");
    $HTTP_SESSION_VARS['test'] = "blabla";
    phpinfo();
?>
<a href="/test.php">test</a>


test.php
<?php
    print "session var = " . $HTTP_SESSION_VARS['test'];
?>

Config file
<VirtualHost 192.168.0.7>
        ServerAdmin [EMAIL PROTECTED]
        DocumentRoot /www/medialib-dev/htdocs
        ServerName medialib-dev.globalbeach.com
        ErrorLog        /www/medialib-dev/logs/error_log
        CustomLog       /www/medialib-dev/logs/access_log common
        php_flag register_globals off
        php_flag track_vars on
        php_value auto_prepend_file "/usr/local/apache/conf/pgsql_session_handler.php"
        php_value include_path "/www/medialib-dev/libs"
        php_value open_basedir "/www/medialib-dev"
</VirtualHost>


---------------------------------------------------------------------------

[2001-01-23 16:19:13] [EMAIL PROTECTED]
it won't print the contents this way. you must use either
echo "session var test = {$HTTP_SESSION_VARS[test]}";
or 
echo "session var test = " . $HTTP_SESSION_VARS[test];

if this solves your problem, close the bug, please.

---------------------------------------------------------------------------

[2001-01-23 13:49:50] [EMAIL PROTECTED]
Yes I did, I followed the examples described in the latest documentation.

session_register("test");
$HTTP_SESSION_VARS['test'] = '12345';

when I try to print on another page, 
echo "session var test = $HTTP_SESSION_VARS[test]";
it comes up empty...?

When I look in the database, I have a session record, but the data is empty?

Serge

---------------------------------------------------------------------------

The remainder of the comments for this report are too long.  To view the rest of the 
comments, please view the bug report online.

Full Bug description available at: http://bugs.php.net/?id=8772


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to