ID:               46960
 Updated by:       dmi...@php.net
 Reported By:      rutekp at freelance-worker dot net
-Status:           Assigned
+Status:           Closed
 Bug Type:         Reproducible crash
 Operating System: Centos 5 x64
 PHP Version:      5.2.8
 Assigned To:      dmitry
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

The bug is already fixed in PHP-5.3 with Garbage Collector which
collects cyclic references. In PHP-5.2 this bug will never fixed.

You can get the same memory leaks with smaller script:

<?php
$array = array(1,2,3);
$array["foo"] = &$array;
$array["blah"] = &$array;
?>

In case your script creates cyclic structures, in 5.2 it's better to
break cycles before exit manually.

<?php
$array = array(1,2,3);
$array["foo"] = &$array;
$array["blah"] = &$array;
$array["foo"] = null;
$array["blah"] = null;
?>


Previous Comments:
------------------------------------------------------------------------

[2008-12-28 08:37:47] rutekp at freelance-worker dot net

Description:
------------
When I try to excedue code which is below without:
$array["foo"] = null;
$array["blah"] = null;

have errors like 
Actual location (location was relayed)
Freeing 0x05298E00



Reproduce code:
---------------
--TEST--
Test session_encode() function : variation
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php

ob_start();
echo "*** Testing session_encode() : variation ***\n";
var_dump(session_start());
$array = array(1,2,3);
$array["foo"] = &$array;
$array["blah"] = &$array;
$_SESSION["data"] = &$array;
var_dump(session_encode());
var_dump(session_destroy());
echo "Done";
ob_end_flush();
?>
--EXPECTF--
*** Testing session_encode() : variation ***
bool(true)
string(64) 
"data|a:5:{i:0;i:1;i:1;i:2;i:2;i:3;s:3:"foo";R:1;s:4:"blah";R:1;}"
bool(true)
Done


Actual result:
--------------
[Thu Oct 30 20:56:43 2008]  Script: 
'ext/session/tests/session_encode_variation5.phpt'
/root/src/php-5.2.6/Zend/zend_vm_execute.h(3565) :  Freeing 0x05293DD8
(24 bytes), script=ext/session/tests/session_encode_variation5.phpt
Last leak repeated 2 times
[Thu Oct 30 20:56:43 2008]  Script: 
'ext/session/tests/session_encode_variation5.phpt'
/root/src/php-5.2.6/Zend/zend_vm_execute.h(3610) :  Freeing 0x05298CC8
(72 bytes), script=ext/session/tests/session_encode_variation5.phpt
/root/src/php-5.2.6/Zend/zend_API.c(827) : Actual location (location
was relayed)
Last leak repeated 1 time
[Thu Oct 30 20:56:43 2008]  Script: 
'ext/session/tests/session_encode_variation5.phpt'
/root/src/php-5.2.6/Zend/zend_vm_execute.h(3596) :  Freeing 0x05298E00
(71 bytes), script=ext/session/tests/session_encode_variation5.phpt
/root/src/php-5.2.6/Zend/zend_hash.c(388) : Actual location (location
was relayed)
Last leak repeated 2 times
[Thu Oct 30 20:56:43 2008]  Script: 
'ext/session/tests/session_encode_variation5.phpt'
/root/src/php-5.2.6/Zend/zend_execute.c(834) :  Freeing 0x05299050 (24
bytes), script=ext/session/tests/session_encode_variation5.phpt
[Thu Oct 30 20:56:43 2008]  Script: 
'ext/session/tests/session_encode_variation5.phpt'
/root/src/php-5.2.6/Zend/zend_hash.c(247) :  Freeing 0x052990C0 (75
bytes), script=ext/session/tests/session_encode_variation5.phpt
Last leak repeated 1 time
=== Total 11 memory leaks detected ===


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=46960&edit=1

Reply via email to