1
kaotik
unserialize(): Argument is not a string
  • 2005/6/24 12:12

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


I have the following code:

if (isset($_SESSION['kshopuser'])) {
$USER=unserialize($_SESSION['kshopuser']);
}else{
$_SESSION['kshopuser'] = array();
}


This generates this notice:
Notice [PHP]: unserialize(): Argument is not a string in file c:blablablaa

I've been tring to fix this without sucess. Can anyone point me in the right direction?

Thanks

2
Mithrandir
Re: unserialize(): Argument is not a string

do a
var_dump($_SESSION['kshopuser']);


just before the
$USER = ...
"When you can flatten entire cities at a whim, a tendency towards quiet reflection and seeing-things-from-the-other-fellow's-point-of-view is seldom necessary."

Cusix Software

3
kaotik
Re: unserialize(): Argument is not a string
  • 2005/6/24 13:21

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


Thanks Mithrandir!
Should have thought of that before posting

In case anyone else runs into a similar problem, here's my solution:
if (isset($_SESSION['kshopuser']) && !$_SESSION['kshopuser']="") {
//var_dump($_SESSION['kshopuser']);
$USER=unserialize($_SESSION['kshopuser']);
}else{
$_SESSION['kshopuser'] = array();
}

4
m0nty
Re: unserialize(): Argument is not a string
  • 2005/6/24 13:24

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


//var_dump($_SESSION['kshopuser']);

you will need to remove the // for it to work as it would be ignored if commented out.

5
Dave_L
Re: unserialize(): Argument is not a string
  • 2005/6/24 15:11

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Quote:
if (isset($_SESSION['kshopuser']) && !$_SESSION['kshopuser']="") {


Here is a simpler way:

if (!empty($_SESSION['kshopuser'])) {

6
kaotik
Re: unserialize(): Argument is not a string
  • 2005/6/24 15:41

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


monty: I just left that line in for future troubleshooting

Dave_L: Thanks!

Login

Who's Online

470 user(s) are online (62 user(s) are browsing Support Forums)


Members: 0


Guests: 470


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Sep 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits