| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2020-12-09 14:45 UTC] cmb@php.net
 
-Status:      Open
+Status:      Closed
-Assigned To:
+Assigned To: cmb
  [2020-12-09 14:45 UTC] cmb@php.net
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 07:00:01 2025 UTC | 
Description: ------------ When an exception is thrown but uncaught, it causes a memory leak for the exception object and also op_array zend engine performs zend_bailout() at php_error_cb(). Running the test in Dr. Memory shows leaks. Test script: --------------- <?php function inverse($x) { if (!$x) { throw new Exception('Division by zero.'); } return 1/$x; } echo inverse(5) . "\n"; echo inverse(0) . "\n"; // Continue execution echo "Hello World\n"; ?> Expected result: ---------------- No leaks should be expected. Actual result: -------------- Dr. Memory log: Error #1: LEAK 128 direct bytes 0x1626e940-0x1626e9c0 + 504 indirect bytes # 0 replace_malloc [d:\drmemory_package\common\alloc_replace.c:2576] # 1 php7_debug.dll!__zend_malloc [c:\php-sdk\phpdev\vc14\x86\php-7.1.2-src\zend\zend_alloc.c:2820] # 2 php7_debug.dll!emalloc [c:\php-sdk\phpdev\vc14\x86\php-7.1.2-src\zend\zend_alloc.c:2413] # 3 php7_debug.dll!zend_compile [c:\php-sdk\phpdev\vc14\x86\php-7.1.2-src\zend\zend_language_scanner.l:591] # 4 php7_debug.dll!compile_file [c:\php-sdk\phpdev\vc14\x86\php-7.1.2-src\zend\zend_language_scanner.l:635] # 5 php7_debug.dll!phar_compile_file [c:\php-sdk\phpdev\vc14\x86\php-7.1.2-src\ext\phar\phar.c:3320] # 6 php7_debug.dll!zend_execute_scripts [c:\php-sdk\phpdev\vc14\x86\php-7.1.2-src\zend\zend.c:1469] # 7 php7_debug.dll!php_execute_script [c:\php-sdk\phpdev\vc14\x86\php-7.1.2-src\main\main.c:2537] # 8 do_cli [c:\php-sdk\phpdev\vc14\x86\php-7.1.2-src\sapi\cli\php_cli.c:993] # 9 main [c:\php-sdk\phpdev\vc14\x86\php-7.1.2-src\sapi\cli\php_cli.c:1381] Error #2: LEAK 136 direct bytes 0x16270df0-0x16270e78 + 288 indirect bytes # 0 replace_malloc [d:\drmemory_package\common\alloc_replace.c:2576] # 1 php7_debug.dll!__zend_malloc [c:\php-sdk\phpdev\vc14\x86\php-7.1.2-src\zend\zend_alloc.c:2820] # 2 php7_debug.dll!emalloc [c:\php-sdk\phpdev\vc14\x86\php-7.1.2-src\zend\zend_alloc.c:2413] # 3 php7_debug.dll!zend_objects_new [c:\php-sdk\phpdev\vc14\x86\php-7.1.2-src\zend\zend_objects.c:171] # 4 php7_debug.dll!zend_default_exception_new_ex [c:\php-sdk\phpdev\vc14\x86\php-7.1.2-src\zend\zend_exceptions.c:210] # 5 php7_debug.dll!zend_default_exception_new [c:\php-sdk\phpdev\vc14\x86\php-7.1.2-src\zend\zend_exceptions.c:244] # 6 php7_debug.dll!_object_and_properties_init [c:\php-sdk\phpdev\vc14\x86\php-7.1.2-src\zend\zend_api.c:1302] # 7 php7_debug.dll!_object_init_ex [c:\php-sdk\phpdev\vc14\x86\php-7.1.2-src\zend\zend_api.c:1310] # 8 php7_debug.dll!ZEND_NEW_SPEC_CONST_HANDLER [c:\php-sdk\phpdev\vc14\x86\php-7.1.2-src\zend\zend_vm_execute.h:3217] # 9 php7_debug.dll!execute_ex [c:\php-sdk\phpdev\vc14\x86\php-7.1.2-src\zend\zend_vm_execute.h:432] #10 php7_debug.dll!zend_execute [c:\php-sdk\phpdev\vc14\x86\php-7.1.2-src\zend\zend_vm_execute.h:474] #11 php7_debug.dll!zend_execute_scripts [c:\php-sdk\phpdev\vc14\x86\php-7.1.2-src\zend\zend.c:1475]