Search code examples
phpclassphp4

PHP4 session / object problem


I have a weird problem with PHP4

I have a class which assigns a $_SESSION variable.

On the local dev server it works as: $_SESSION['foo'] = $this->foo; and I can access $_SESSION['foo'] as a string.

on the live server $_SESSION['foo'] is not a string but a serialized object? the same code?


Solution

  • OK, I found out that $_SESSION['myvar'] becomes a global $myvar, and was being overritten by the instance variable $myvar = new MyClass();