php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31926 php in free() error with RecursiveArrayIterator
Submitted: 2005-02-11 03:10 UTC Modified: 2005-04-04 21:12 UTC
From: gms08701 at yahoo dot com Assigned: helly (profile)
Status: Not a bug Package: SPL related
PHP Version: 5CVS-2005-03-23 OS: FreeBSD 5.3
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gms08701 at yahoo dot com
New email:
PHP Version: OS:

 

 [2005-02-11 03:10 UTC] gms08701 at yahoo dot com
Description:
------------
Trying to create a RecursiveArrayIterator class, 
using currently available SPL classes.
Its generating this error ->
php in free(): warning: chunk is already free

Apparently it works on win2k ->
http://marc.theaimsgroup.com/?l=php-general&m=110807956115501&w=2

Reproduce code:
---------------
<?php

$array = array(0 => array('world'));

class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator {
   function hasChildren() {
       return (is_array($this->current()));
   }

   function getChildren() {
       return new self($this->current());
   }
}

$it = new RecursiveIteratorIterator(new RecursiveArrayIterator($array));
foreach($it as $key => $val) {
   var_dump($key, $val);
}

?>

Expected result:
----------------
$ php -f z.php
int(0)
string(5) "world"

Actual result:
--------------
$ php -f z.php
int(0)
string(5) "world"
php in free(): warning: chunk is already free

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-13 15:27 UTC] helly@php.net
Please do the following:
php run-tests.php ext/spl
and copy the output here

if you have also this:
memcheck php ext/spl/tests/bug31926.php
but just report if it states any real errors besides the messages stating that some memory is still accessible at program end.

For me the problem is solved both in HEAD and 5.0.4-dev but i don't use FreeBSD.
 [2005-03-25 23:59 UTC] sniper@php.net
Please try using this CVS snapshot:

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

I can't reproduce this. Are you sure it's just something wrong with your system? Can you reproduce it on other machines?

 [2005-03-26 22:21 UTC] gms08701 at yahoo dot com
I can reproduce it on 2 separate machines running FreeBSD 5.3.
I also posted an email to FreeBSD's ports mailing list around the time when I filed this bug report, and someone wrote back saying that they can reproduce it on their machine running FreeBSD 5.3.
Unfortunately for me, spare time is becoming scarce, and I wouldn't be able to keep up with this bug report.
So if this is something that cannot be reproduced by php dev, then feel free to mark this report "closed" or "no feedback", or whatever is appropriate.
Maybe someone else who has time, that is running 
FreeBSD 5.3 can pick this up.

Thank you.
 [2005-04-04 21:12 UTC] sniper@php.net
Can not reproduce.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC