php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32226 I get segmentation fault (mis?)using set_exception_handler
Submitted: 2005-03-07 20:02 UTC Modified: 2005-03-07 20:35 UTC
From: michael at zend dot com Assigned: helly (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2005-03-07 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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: michael at zend dot com
New email:
PHP Version: OS:

 

 [2005-03-07 20:02 UTC] michael at zend dot com
Description:
------------
I get segmentation fault, when running the following code:

Reproduce code:
---------------
<?

class A
{
        public function A()
        {
                set_exception_handler(array($this, 'EH'));

                throw new Exception();
        }

        public function EH()
        {
                restore_exception_handler();

                throw new Exception();
        }
}

$a = new A();

?>


Expected result:
----------------
Something better, than Segfault ;)

Actual result:
--------------
Segmentation fault (core dumped)

......

#0  zend_hash_merge_ex (target=0x83064f8, source=0x98, pCopyConstructor=0x81d9750 <zval_add_ref>, size=4, 
    pMergeSource=0x81cb9e0 <do_inherit_constant_check>, pParam=0x0)
    at /home/michael/phprepos/php-src/Zend/zend_hash.c:818
818         p = source->pListHead;
(gdb) bt
#0  zend_hash_merge_ex (target=0x83064f8, source=0x98, pCopyConstructor=0x81d9750 <zval_add_ref>, size=4, 
    pMergeSource=0x81cb9e0 <do_inherit_constant_check>, pParam=0x0)
    at /home/michael/phprepos/php-src/Zend/zend_hash.c:818
#1  0x081cba99 in zend_do_implement_interface (ce=0x8306460, iface=0x0)
    at /home/michael/phprepos/php-src/Zend/zend_compile.c:2096
#2  0x081de8d9 in zend_class_implements (class_entry=0x8306460, num_interfaces=2)
    at /home/michael/phprepos/php-src/Zend/zend_API.c:1650
#3  0x080fa120 in zm_startup_sqlite (type=1, module_number=4)
    at /home/michael/phprepos/php-src/ext/sqlite/sqlite.c:1018
#4  0x081dd858 in zend_register_module_ex (module=0x83037f0) at /home/michael/phprepos/php-src/Zend/zend_API.c:1227
#5  0x081a3ba0 in php_startup_extensions (ptr=0x82bc4ac, count=152) at /home/michael/phprepos/php-src/main/main.c:1267
#6  0x0825da5b in php_startup_internal_extensions () at main/internal_functions_cli.c:74
#7  0x081a4170 in php_module_startup (sf=0x0, additional_modules=0x0, num_additional_modules=152)
    at /home/michael/phprepos/php-src/main/main.c:1450
#8  0x0825c9ce in main (argc=3, argv=0xbffffa44) at /home/michael/phprepos/php-src/sapi/cli/php_cli.c:622


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-07 20:31 UTC] helly@php.net
The problem is that after throwing the exception the instance immediatley gets destructed. Thus the target for the handler is no longer available.
 [2005-03-07 20:35 UTC] helly@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

This seems to be a 5.1-dev only thing. Still i MFHed the fix to prevent from MFHing it with some other stuff later.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Sep 19 16:01:27 2024 UTC