php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30674 Unexpected results and core dump with recursive references serializing
Submitted: 2004-11-03 16:29 UTC Modified: 2005-05-21 01:00 UTC
From: fmmarzoa at gmx dot net Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5CVS-STABLE-2005-03-07 OS: *
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: fmmarzoa at gmx dot net
New email:
PHP Version: OS:

 

 [2004-11-03 16:29 UTC] fmmarzoa at gmx dot net
Description:
------------
serialize function lost references to itself on an array and produces a segfault in some other circunstances. I send the code with which I've discovered the problem, but Andrey Hristov has also cooked some code based on this that crash the PHP engine. 

Complete quoted thread with more code samples can be found on the internals list archive:

http://marc.theaimsgroup.com/?l=php-dev&m=109949534625983&w=2

Reproduce code:
---------------
<pre>
<?php

$Arr = array();
$Arr['self'] = &$Arr;
var_dump ( $Arr );

$serdata = serialize ($Arr);
$Arr2 = unserialize ( $serdata );
echo "\n\n";
var_dump ( $Arr2 );

?>
</pre>

Complete quoted thread with more code samples, including segfaults, can be found on the internals list archive:
http://marc.theaimsgroup.com/?l=php-dev&m=109949534625983&w=2


Expected result:
----------------
array(1) {
 ["self"]=>
 array(1) {
   ["self"]=>
   *RECURSION*
 }
}

array(1) {
 ["self"]=>
 array(1) {
   ["self"]=>
   *RECURSION*
 }
} 

Actual result:
--------------
array(1) {
 ["self"]=>
 array(1) {
   ["self"]=>
   *RECURSION*
 }
}

array(1) {
 ["self"]=>
 array(1) {
   ["self"]=>
   NULL
 }
} 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-03 16:47 UTC] fmmarzoa at gmx dot net
(just changed "crashed" by "core dump" in subject)
 [2005-03-07 21:58 UTC] sniper@php.net
I can not reproduce this with latest HEAD branch but
PHP_5_0 branch is still broken.

 [2005-05-13 22:56 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.0-win32-latest.zip

Can't reproduce it with latest CVS.
 [2005-05-21 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 00:01:28 2024 UTC