Re: WDDX

From: Date: Fri, 08 Jan 1999 02:15:08 +0000
Subject: Re: WDDX
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-3386@lists.php.net to get a copy of this message
On 7 Jan 99, at 12:04, Rasmus Lerdorf wrote: > I would prefer to have it look more like this: > > $a = 1; > $b = "abc"; > $str = wddx_serialize($a,$b); > unset($a); > unset($b); > > wddx_unserialize($str); > echo $a; > echo $b; > > Perhaps an optional argument on wddx_unserialize() which tells the > function what to do if any of the variables it is about to create already > exists. Like a no clobber flag. And perhaps also a rename option. eg. > > wddx_unserialize($str) /* default - overwrite existing vars */ > wddx_unserialize($str,1) /* do not overwrite existing vars */ > wddx_unserialize($str,2) /* rename to $wddx_a and $wddx_b */ What about this: unset($hash); wddx_unserialize($str, &$hash); echo $hash['a']; echo $hash['b']; That will completely eliminate any interference with existing variables. You can never be 100% certain of what $str contains. It might have unexpected data, or it might be corrupted. It should not be allowed even the possibility of having unexpected side-effects. Dave ---------------------------------------------------------------------- Dave Walton Webmaster, Postmaster Nordic Entertainment Worldwide walton@nordicdms.com http://www.nordicdms.com ---------------------------------------------------------------------- -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#3386) next »