php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79987 Memory leak in SplFileInfo because of missing zend_restore_error_handling()
Submitted: 2020-08-18 08:00 UTC Modified: 2020-08-18 08:00 UTC
From: dmitry@php.net Assigned: dmitry (profile)
Status: Closed Package: SPL related
PHP Version: 8.0Git-2020-08-18 (Git) OS: *
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: dmitry@php.net
New email:
PHP Version: OS:

 

 [2020-08-18 08:00 UTC] dmitry@php.net
Description:
------------
Some SplFileInfo methods don't restore original error handler in exceptional cases.
This leads to memory leaks.

Test script:
---------------
<?php
class BadSplFileInfo extends SplFileInfo {
    public function __construct() {
    }
}
$x = new BadSplFileInfo();
set_error_handler(function ($type, $msg, $file, $line, $context = []) {
    echo "ops\n";
});
try {
    var_dump($x->getLinkTarget());
} catch (Throwable $e) {
    echo $e->getMessage() . "\n";
}
?>

Expected result:
----------------
Object not initialized


Actual result:
--------------
Object not initialized
Zend/zend_closures.c(479) :  Freeing 0xf3c5d380 (204 bytes)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-08-18 08:00 UTC] dmitry@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: dmitry
 [2020-08-18 08:08 UTC] dmitry@php.net
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8c900022014cd7cff0d7708f3dc7041e42db97b7
Log: Fixed bug #79987 (Memory leak in SplFileInfo because of missing zend_restore_error_handling())
 [2020-08-18 08:08 UTC] dmitry@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 13:01:29 2024 UTC