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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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

Add a Patch

Pull Requests

Add a Pull Request

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 Apr 18 23:01:27 2024 UTC