Bug #79987 [NEW]: Memory leak in SplFileInfo because of missing zend_restore_error_handling()

From: Date: Tue, 18 Aug 2020 08:00:31 +0000
Subject: Bug #79987 [NEW]: Memory leak in SplFileInfo because of missing zend_restore_error_handling()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228630@lists.php.net to get a copy of this message
From: dmitry Operating system: * PHP version: 8.0Git-2020-08-18 (Git) Package: SPL related Bug Type: Bug Bug description:Memory leak in SplFileInfo because of missing zend_restore_error_handling() 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) -- Edit bug report at https://bugs.php.net/bug.php?id=79987&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79987&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79987&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79987&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79987&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79987&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79987&r=support Expected behavior: https://bugs.php.net/fix.php?id=79987&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79987&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79987&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79987&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79987&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79987&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79987&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79987&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79987&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79987&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79987&r=mysqlcfg

« previous php.bugs (#228630) next »