PHP 4.0 Bug #8562 Updated: Sessions fail with Netscape
| From: | pojanen at pp dot htv dot fi | Date: | Wed, 17 Jan 2001 08:36:33 +0000 |
| Subject: | PHP 4.0 Bug #8562 Updated: Sessions fail with Netscape | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-44321@lists.php.net to get a copy of this message | ||
ID: 8562
User Update by: pojanen@pp.htv.fi
Old-Status: Open
Status: Closed
Bug Type: *Session related
Description: Sessions fail with Netscape
Hours of debugging... debugging... recoding...
Result: I gues the bug is in Netscape 4.08.. not in PHP.
Reason: If I remove images from the login template it will work. It will also work if I set disk
cache to 0.
Too bad... I guess there is no way to fix this.
Previous Comments:
---------------------------------------------------------------------------
[2001-01-08 03:00:46] pojanen@pp.htv.fi
I have tried to get around the problem..
Now it always registers the session but it looses a lot of data (classes). Sometimes it works ok..
after pressing reload couple of times. So the problem really is like in PHP 4.03, classes won't
be stored properly. But now it's Netscape specific.
I'm using one session variable, $SESSION. It's an array. Which contains ShoppingCart and
ClientConfig classes.
So I register the session like this...
session_start();
if(!session_is_registered("SESSION")) session_register("SESSION");
In my functions I use $SESSION as global..
global $SESSION;
And when I try to access a function..
$SESSION["ShoppingCart"]->getOwner() it says:
Fatal error: Call to a member function on a non-object in...
Sometimes it works. In IE, always.
Ofcourse I have created the classes inside the session..
like this:
if(!isset($SESSION)) $SESSION = array();
if(!isset($SESSION["ShoppingCart"])) $SESSION["ShoppingCart"] = new
ShoppingCart;
if(!isset($SESSION["ClientConfig"])) $SESSION["ClientConfig"] = new
ClientConfig;
(The first line is not so important)
Constructors of these classes set variable defaults and creates some arrays. One of the arrays
inside the ShoppingCart class constructs from ShoppingCartElement class.
Sorry, not so complete code but I hope it helps.
Btw. I have tried with Netscape 6 and it works Ok.
---------------------------------------------------------------------------
[2001-01-06 20:24:50] sniper@php.net
Please add a complete but short script which can be used to reproduce this
problem.
Have you tried newer Netscape versions? 4.08 is quite old.
--Jani
---------------------------------------------------------------------------
[2001-01-05 04:31:56] pojanen@pp.htv.fi
PHP 4.0.3 was very buggy with sessions. PHP 4.0.4 works a lot better but I think I have discovered a
bug again.
I can't find anything wrong in my code... the bug is very weird. It only happens with Netscape.
Netscape Navigator 4.08.
When I try to login (with Netscape 4.08) in my webshop using a form generated by the webshop ->
sessions doesn't get saved correctly. But when I press Reload -> the problem will be
corrected. With Internet Explorer this works fine at the first time.
Here is the incorrect session data:
SESSION|a:2:{s:12:"ShoppingCart";O:12:"shoppingcart":3:{s:8:"products";a:0:{}s:9:"discounts";a:0:{}s:5:"owner";i:0;}s:12:"ClientConfig";O:12:"clientconfig":3:{s:12:"showPictures";b:1;s:14:"productsOnPage";i:10;s:8:"currency";s:3:"FIM";}}
Here is the correct one (after I press reload or first time with IE):
SESSION|a:2:{s:12:"ShoppingCart";O:12:"shoppingcart":3:{s:8:"products";a:0:{}s:9:"discounts";a:0:{}s:5:"owner";s:1:"2";}s:12:"ClientConfig";O:12:"clientconfig":3:{s:12:"showPictures";b:1;s:14:"productsOnPage";s:1:"8";s:8:"currency";s:3:"FIM";}}
They look pretty same but they are not. owner values should be 2 like in the second example and
productsOnPage should be 8.. 0 and 10 are defaults (in the first one) but they are modified to 2 and
8. Somehow PHP doesn't save the modified values.. it saves the first values which are made by
my class constructor. (I use $SESSION array which contains two classes)
This is very very STRANGE. Browser shouldn't have anything to do with it but it does. I do no
browser checkups so it must be in PHP. If cookies are enabled/disabled it does the same thing.
And btw. This works correctly in PHP 4.0. but not in 4.03 & 4.04.
What could be wrong ?
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=8562