|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36886 memory leaks in stream problems
Submitted: 2006-03-28 11:01 UTC Modified: 2006-03-28 18:01 UTC
From: sqchen at citiz dot net Assigned:
Status: Closed Package: Streams related
PHP Version: 5.1.2 OS: redhat 7.3
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.
Block user comment
Status: Assign to:
Bug Type:
From: sqchen at citiz dot net
New email:
PHP Version: OS:


 [2006-03-28 11:01 UTC] sqchen at citiz dot net
It seems that stream function can cause memory leaks so easily. We hope the stream developer  fix it as soon as possible.

Here is another one: it leaks when you add ./configure --enable-debug

Reproduce code:
class upper_filter extends php_user_filter{
      function filter($in, $out, &$consumed, $closing) {
$fp=fopen("2.txt", "w");
$bucket=stream_bucket_new($fp, "Abc\n");
     $bucket->data = strtoupper($bucket->data);
         $consumed += $bucket->datalen;
   stream_bucket_append($out, $bucket);
return PSFS_PASS_ON;
stream_filter_register("upper", "upper_filter");
$fp=fopen("2.txt", "w");
stream_filter_append($fp,  "upper");
fread($fp, 1024);
fwrite($fp, "Thank you\n");

Actual result:
[sqchen@localhost sqchen]$ $php tt.php


[Tue Mar 28 16:54:43 2006]  Script:  'tt.php'
/home/sqchen/sqchen/php-5.1.2/main/streams/filter.c(129) :  Freeing 0x083EE864 (10 bytes), script=tt.php
[Tue Mar 28 16:54:43 2006]  Script:  'tt.php'
/home/sqchen/sqchen/php-5.1.2/main/streams/filter.c(126) :  Freeing 0x083EE814 (32 bytes), script=tt.php
=== Total 2 memory leaks detected ===


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-28 18:01 UTC]
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
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC