php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3559 Serialize does not reset() regular and hash arrays
Submitted: 2000-02-21 23:33 UTC Modified: 2002-09-30 18:52 UTC
From: simon at unitycode dot org Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.14 OS: RedHat 6.0, Win2K
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: simon at unitycode dot org
New email:
PHP Version: OS:

 

 [2000-02-21 23:33 UTC] simon at unitycode dot org
<?
$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);

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-30 18:52 UTC] hholzgra@php.net
works in 4.2.3
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 04:01:36 2025 UTC