#36840 [Csd->Asn]: Memory leak if cast operator throws an exception that is caught
| From: | dmitry@php.net | Date: | Mon, 27 Mar 2006 07:33:36 +0000 |
| Subject: | #36840 [Csd->Asn]: Memory leak if cast operator throws an exception that is caught | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-94914@lists.php.net to get a copy of this message | ||
ID: 36840
Updated by: dmitry@php.net
Reported By: andrei@php.net
-Status: Closed
+Status: Assigned
Bug Type: Scripting Engine problem
PHP Version: 6CVS-2006-03-24 (CVS)
Assigned To: dmitry
New Comment:
Re-opened.
Throwing exceptions from conversion routines is bad solution. They are
called from many different places and we cannot fix every place to care
about exception.
Previous Comments:
------------------------------------------------------------------------
[2006-03-24 11:13:56] dmitry@php.net
Fixed in CVS HEAD.
------------------------------------------------------------------------
[2006-03-24 08:52:32] andrei@php.net
Description:
------------
If a cast operator inside try {} block throws an exception, the result
of casting is never destructed and, thus, a memory leak happens.
Reproduce code:
---------------
<?php
$u = "abc \udc00 def\n";
try {
echo (binary)$u;
} catch(UnicodeConversionException $e) {
}
?>
INI settings:
unicode_semantics = on
unicode.output_encoding = latin-1
unicode.runtime_encoding = latin-1
unicode.from_error_mode = U_CONV_ERROR_STOP | U_CONV_ERROR_EXCEPTION
Expected result:
----------------
no output
Actual result:
--------------
[Thu Mar 23 23:49:50 2006] Script: 't.php'
/homes/andrei/dev/php-src/Zend/zend_unicode.c(253) : Freeing
0x013EC764 (11 bytes), script=t.php
=== Total 1 memory leaks detected ===
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36840&edit=1