Bug #3559: Serialize does not reset() regular and hash arrays
| From: | simon at unitycode dot org | Date: | Tue, 22 Feb 2000 04:33:25 +0000 |
| Subject: | Bug #3559: Serialize does not reset() regular and hash arrays | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-15786@lists.php.net to get a copy of this message | ||
From: simon@unitycode.org
Operating system: RedHat 6.0, Win2K
PHP version: 3.0.14
PHP Bug Type: Misbehaving function
Bug description: Serialize does not reset() regular and hash arrays
<?
$testvalue = Array('Hi' => 'There', 'Yo' => 'Joe');
$value = serialize($testvalue);
while ( list($key, $val) = each($testvalue) )
{
echo "Via Links (broken): $key = $val<br>\n";
}
echo "Direct Access (works): $testvalue[Hi], $testvalue[Yo]<br>\n";
?>
Temporary fix: reset($your_array); after serialization.
(perm fix courtesy of zerodiv@zerodivide.net)
Permenant fix (version 3.0.x): ~line 240:
php3api_var_serialize(buf, data);
}
// THIS IS THE FIX
_php3_hash_internal_pointer_reset(struc->value.ht);
// END OF FIX
}
STR_CAT(buf, "}", 1);