View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0000389 | Xdebug | Uncategorized | public | 2008-07-18 16:00 | 2020-03-18 18:44 |
| Reporter | sklar | Assigned To | |||
| Priority | normal | Severity | feature | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Summary | 0000389: Destructors called on fatal error | ||||
| Description | When xdebug is disabled (or not installed), object destructors are not called on fatal error. With xdebug enabled, object destructors are called when there's a fatal error. This can be a big problem if the object destructor behaves unpredictably (or badly) because of whatever caused the fatal error (so that variables expected to be set are not, etc.) | ||||
| Additional Information | Test script: <?php print "xdebug is " . (xdebug_is_enabled() ? "on" : "off") . "\n"; class Food { $f = new Food(); ?> == % /tmp/php-5.2.6/bin/php test.php Fatal error: Class 'Abc' not found in /private/tmp/xdebug-destructor-test/test.php on line 13 Call Stack: __destruct called == % /tmp/php-5.2.6/bin/php -d xdebug.default_enable=0 test.php Fatal error: Class 'Abc' not found in /private/tmp/xdebug-destructor-test/test.php on line 13 | ||||
| Tags | No tags attached. | ||||
| Operating System | OS X: Darwin host.local 8.11.1 Darwin Kernel Version 8.11.1: Wed Oct 10 18:23:28 PDT 2007; root:xnu-792.25.20~1/RELEASE_I386 i386 i386 | ||||
| PHP Version | 5.2.6 | ||||
|
|
While this is unexpected behaviour with standard PHP, it may not be harmful in all cases. My application actually benefits from it. Personally I would prefer if PHP handled a fatal error the same way as with XDebug. If this bug gets fixed, I would like to have this as a configuration option. |
|
|
related to 0000391 |
|
|
Fixed in rev. 3177. |
|
|
FWIW, PHP 8 now makes destructors get called upon fatal errors. So this bug is now "invalid" for PHP 8. I've disabled the test for that version therefore. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2008-07-18 16:00 | sklar | New Issue | |
| 2008-10-15 14:58 | MP_ | Note Added: 0000890 | |
| 2008-12-11 21:09 | k-fish | Note Added: 0000898 | |
| 2009-12-29 17:00 | derick | Note Added: 0001230 | |
| 2009-12-29 17:00 | derick | Status | new => closed |
| 2009-12-29 17:00 | derick | Resolution | open => fixed |
| 2020-03-12 16:55 | derick | Severity | major => feature |
| 2020-03-12 17:16 | derick | Category | Feature/Change request => Uncategorized |
| 2020-03-18 18:44 | derick | Note Added: 0005301 |