php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61828 Memleak when calling Directory(Recursive)Iterator/Spl(Temp)FileObject ctor twice
Submitted: 2012-04-23 16:10 UTC Modified: 2013-06-25 05:16 UTC
From: felipe@php.net Assigned: laruence (profile)
Status: Closed Package: SPL related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2012-04-23 16:10 UTC] felipe@php.net
Description:
------------
See below.

Test script:
---------------
<?php

$x = new DirectoryIterator('.');
$x->__construct('.');


Actual result:
--------------
/home/felipe/dev/php-src/main/streams/streams.c(530) : Stream of type 'dir' 0x7fd490d7e5c0 (path:(null)) was not closed
[Mon Apr 23 13:07:34 2012]  Script:  '../bug.php'
/home/felipe/dev/php-src/main/streams/streams.c(292) :  Freeing 0x7FD490D7E5C0 (248 bytes), script=../bug.php
/home/felipe/dev/php-src/main/streams/plain_wrapper.c(883) : Actual location (location was relayed)
[Mon Apr 23 13:07:34 2012]  Script:  '../bug.php'
/home/felipe/dev/php-src/ext/spl/spl_directory.c(252) :  Freeing 0x7FD490D7EA08 (2 bytes), script=../bug.php
=== Total 2 memory leaks detected ===


Patches

0001-Fixed-bug-61828-Memleak-when-calling-Directory-Recur (last revision 2012-04-30 03:47 UTC by reeze dot xia at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-23 16:12 UTC] felipe@php.net
-Summary: Memory when calling DirectoryIterator's constructor twice +Summary: Memory when calling DirectoryIterator/SplFileObject/SplTempFileObject ctor twice
 [2012-04-23 16:15 UTC] felipe@php.net
-Summary: Memory when calling DirectoryIterator/SplFileObject/SplTempFileObject ctor twice +Summary: Memleak when calling Directory(Recursive)Iterator/Spl(Temp)FileObject ctor twice
 [2012-04-30 03:49 UTC] reeze dot xia at gmail dot com
Hi, felipe:
   I have attached a patch for this bug. and sent pull request at:
https://github.com/php/php-src/pull/71

will you take a look at this request?

Thank you!
 [2013-06-24 19:35 UTC] felipe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: reeze
 [2013-06-24 19:35 UTC] felipe@php.net
I see the pull request was closed... but the fix has been in fact applied?
 [2013-06-25 04:40 UTC] laruence@php.net
-Assigned To: reeze +Assigned To:
 [2013-06-25 04:40 UTC] laruence@php.net
@feilip we dicussed on that PR very hardly, and finally decide to not ci the patch
 [2013-06-25 05:16 UTC] laruence@php.net
-Assigned To: +Assigned To: laruence
 [2013-06-25 05:16 UTC] laruence@php.net
hmm, seems I was wrong, mistake is to another one

thanks for the reminding, I will tweak the patch attached later.
 [2013-06-25 05:40 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=38eb909d064ecbbf51d5869a629dae91a6ed9dcf
Log: Fixed Bug #61828 (Memleak when calling Directory(Recursive)Iterator/Spl(Temp)FileObject ctor twice)
 [2013-06-25 05:40 UTC] laruence@php.net
-Status: Assigned +Status: Closed
 [2014-10-07 23:18 UTC] stas@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=38eb909d064ecbbf51d5869a629dae91a6ed9dcf
Log: Fixed Bug #61828 (Memleak when calling Directory(Recursive)Iterator/Spl(Temp)FileObject ctor twice)
 [2014-10-07 23:29 UTC] stas@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=38eb909d064ecbbf51d5869a629dae91a6ed9dcf
Log: Fixed Bug #61828 (Memleak when calling Directory(Recursive)Iterator/Spl(Temp)FileObject ctor twice)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 05:01:29 2024 UTC