Bug #72213 [ReO->Csd]: Finally leaks on nested exceptions
| From: | dmitry@php.net | Date: | Tue, 24 May 2016 22:26:07 +0000 |
| Subject: | Bug #72213 [ReO->Csd]: Finally leaks on nested exceptions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-201265@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72213&edit=1
ID: 72213
Updated by: dmitry@php.net
Reported by: nikic@php.net
Summary: Finally leaks on nested exceptions
-Status: Re-Opened
+Status: Closed
Type: Bug
Package: Scripting Engine problem
PHP Version: master-Git-2016-05-13 (Git)
Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2ae21abdf7b87ee95d76aca22e787408d7c766cf
Log: Fixed bug #72213 (Finally leaks on nested exceptions).
Previous Comments:
------------------------------------------------------------------------
[2016-05-20 19:50:44] bwoebi@php.net
Re-opened as commit revert automatically closed the bug again.
------------------------------------------------------------------------
[2016-05-17 12:28:39] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=fad91468dbf48401ac3fc719dad3ce9f93e1a378
Log: Revert "Fixed Bug #72213 (Finally leaks on nested exceptions)"
------------------------------------------------------------------------
[2016-05-17 12:28:06] laruence@php.net
you are right. this fix is not complete right, I reverted. thanks
------------------------------------------------------------------------
[2016-05-17 11:45:36] nikic@php.net
This patch does not look correct to me...
First, it breaks this code:
<?php
function test() {
try {
throw new Exception(1);
} finally {
try {
try {
throw new Exception(2);
} finally {}
} catch (Exception $e) {}
}
}
try {
test();
} catch (Exception $e) {
echo "caught {$e->getMessage()}\n";
}
Previously this correctly threw Exception(1), matching Java. Now nothing is thrown instead.
Second, it only avoids the leak for one nesting level. This will still leak:
<?php
function test() {
try {
throw new Exception('a');
} finally {
try {
} finally {
try {
throw new Exception('b');
} finally {
}
}
}
}
try {
test();
} catch (Exception $e) {
echo "caught {$e->getMessage()}\n";
}
------------------------------------------------------------------------
[2016-05-17 07:33:10] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=5037ebf058bdc94e4426240a6d35fcf427d2eee2
Log: Fixed Bug #72213 (Finally leaks on nested exceptions)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=72213
--
Edit this bug report at https://bugs.php.net/bug.php?id=72213&edit=1