Re: cvs: php4 /ext/standard var.c

From: Date: Wed, 11 Jul 2001 16:44:32 +0000
Subject: Re: cvs: php4 /ext/standard var.c
References: 1 2  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-6191@lists.php.net to get a copy of this message
> > Modified files: > > /php4/ext/standard var.c > > Log: > > prevent php from crashing when serializing circular data. > > > > This script produced the crash. > > <? > > $hash["test_key"] = "test_value"; > > $hash["hash_key"] = &$hash; > > echo serialize($hash); > > ?> > > with your patch i don't get the crash but instead: > > > i think we need some extra checks. > > tc I didn't get any of that, but after I woke up this morning I relialized that patch isn't going to solve the problem correctly. For instance, I didn't think of testing: <? $hash["test_key"] = "test_value"; $hash2["hash2_key"] = &$hash; $hash["hash_key"] = &$hash2; echo serialize($hash); ?> Which probably wont be caught by my patch. I'm thinking we need to keep a list of addresses that have been serialized, then before recursing, check to see if the 'new' variable is in the list already, if not then go on with serializing. Shane

« previous php.cvs (#6191) next »