Bug #68652 [NEW]: segmentation fault in destructor
| From: | guoxiao08 at gmail dot com | Date: | Thu, 25 Dec 2014 10:05:15 +0000 |
| Subject: | Bug #68652 [NEW]: segmentation fault in destructor | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-189191@lists.php.net to get a copy of this message | ||
From: guoxiao08 at gmail dot com
Operating system: OSX
PHP version: 5.6.4
Package: Scripting Engine problem
Bug Type: Bug
Bug description:segmentation fault in destructor
Description:
------------
Segmentation fault when two classes call each other in destructors.
Test script:
---------------
<?php
class Foo {
private static $instance;
public static function getInstance() {
if (isset(self::$instance)) {
return self::$instance;
}
return self::$instance = new self();
}
public function __destruct() {
Bar::getInstance();
}
}
class Bar {
private static $instance;
public static function getInstance() {
if (isset(self::$instance)) {
return self::$instance;
}
return self::$instance = new self();
}
public function __destruct() {
Foo::getInstance();
}
}
$foo = new Foo();
Expected result:
----------------
Nothing happend
Actual result:
--------------
segmentation fault
lldb backtrace:
* thread #1: tid = 0x6abacb, 0x000000010025c130
php`zend_update_class_constants + 287, queue = 'com.apple.main-thread',
stop reason = EXC_BAD_ACCESS (code=1, address=0x15)
* frame #0: 0x000000010025c130 php`zend_update_class_constants + 287
frame #1: 0x000000010025c3f2 php`_object_and_properties_init + 98
frame #2: 0x000000010025c45f php`_object_init_ex + 11
frame #3: 0x0000000100296ed9 php`ZEND_NEW_SPEC_HANDLER + 135
frame #4: 0x0000000100280a44 php`execute_ex + 79
frame #5: 0x000000010024b229 php`dtrace_execute_ex + 226
frame #6: 0x00000001002c264d php`zend_do_fcall_common_helper_SPEC +
1223
frame #7: 0x0000000100280a44 php`execute_ex + 79
frame #8: 0x000000010024b229 php`dtrace_execute_ex + 226
frame #9: 0x000000010024cb31 php`zend_call_function + 2268
frame #10: 0x000000010026d188 php`zend_call_method + 588
frame #11: 0x000000010027a489 php`zend_objects_destroy_object + 412
frame #12: 0x000000010027fb2e
php`zend_objects_store_del_ref_by_handle_ex + 504
frame #13: 0x000000010027f8fe php`zend_objects_store_del_ref + 23
frame #14: 0x000000010024b54a php`_zval_ptr_dtor + 66
frame #15: 0x000000010024f40b php`zend_cleanup_user_class_data +
139
frame #16: 0x0000000100265818 php`zend_hash_reverse_apply + 80
frame #17: 0x000000010024b80e php`shutdown_executor + 400
frame #18: 0x00000001002596a5 php`zend_deactivate + 103
frame #19: 0x0000000100200d4f php`php_request_shutdown + 497
frame #20: 0x00000001002e1c7d php`do_cli + 4942
frame #21: 0x00000001002e07ba php`main + 1448
frame #22: 0x00007fff8fbf05c9 libdyld.dylib`start + 1
frame #23: 0x00007fff8fbf05c9 libdyld.dylib`start + 1
--
Edit bug report at https://bugs.php.net/bug.php?id=68652&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68652&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68652&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68652&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68652&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68652&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68652&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68652&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68652&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68652&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68652&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68652&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68652&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68652&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68652&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68652&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68652&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68652&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68652&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68652&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68652&r=mysqlcfg