Re: PHP 4.0 Bug #8433 Updated: Objects are not held in a session
| From: | Ruben Frijns | Date: | Thu, 28 Dec 2000 20:39:11 +0000 |
| Subject: | Re: PHP 4.0 Bug #8433 Updated: Objects are not held in a session | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-42472@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: Bug Database <php-dev@lists.php.net>
To: <info@frijns.net>
Sent: Wednesday, December 27, 2000 11:30 AM
Subject: PHP 4.0 Bug #8433 Updated: Objects are not held in a session
> ID: 8433
> Updated by: jmoore
> Reported By: info@frijns.net
> Old-Status: Open
> Status: Feedback
> Bug Type: *Session related
> Assigned To:
> Comments:
>
> Can you please try with 4.0.4. There were various session/object fixes in
this release.
>
> James
>
I found out what's wrong. Though i don't know if it's a bug. But when you're
within a function you cannot do anything with session variables. When you're
outside a function it's not a problem to use them.
For example
<?PHP
$name = $session["name"];
print ("Name: ".$name );
dosomething();
function dosomething() {
$name = $session["name"];
print ("Name: ".$name );
}
?>
The first line would work and print the name (assuming the $session["name"]
array would have a value). If you would call the function then you will not
see the name on your screen. You will have to provide the session variable
as an argument with the function and return any values and use these values
to update session variables.
This way things work fine.
I don't know if this is PHP typical and should be like this or wether it's a
bug.
Kind regards,
Ruben