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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

History

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