php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3111 Can't set a session variable from an include file
Submitted: 2000-01-05 18:32 UTC Modified: 2000-01-07 06:01 UTC
From: jshuping at scient dot com Assigned:
Status: Closed Package: Other
PHP Version: 4.0 Beta 3 OS: Solaris 2.7 Sparc
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jshuping at scient dot com
New email:
PHP Version: OS:

 

 [2000-01-05 18:32 UTC] jshuping at scient dot com
PHP 4.0b3, compiled with mysql and enable-trans-sid.
Using apache 1.3.9.

Normal php config, GPC_globals is on, using cookies, auto_start = 0.

Here's an example of the problem:
index.php:
<? session_start()
     include('foo.inc');
     testfunc();
?>
<html>
<link to index2.php>
</html>

foo.inc:
<? session_register("USERID");
     $USERID = "foo";
?>

Loading index.php, and clicking on the link to the second page, leaves the following
in /tmp/sess_BLAH:
!USERID|

Whereas putting the contents of testfunc() in index.php and performing the same action leaves the 
contents of sess_BLAH as:
USERID|s:3:"foo";

Is this a bug or am I missing something here?
Thanks
John


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-01-07 06:01 UTC] sas at cvs dot php dot net
session variables must be global variables
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 12:01:30 2024 UTC