Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000389XdebugFeature/Change requestpublic2008-07-18 17:002009-12-29 17:00
Reportersklar 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000389: Destructors called on fatal error
DescriptionWhen 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 InformationTest script:

<?php

print "xdebug is " . (xdebug_is_enabled() ? "on" : "off") . "\n";

class Food {
    public function __destruct() {
        echo "__destruct called\n";
    }
  }

$f = new Food();
echo "forcing fatal error:\n";
Abc::def();

?>

==
Xdebug on, problem happens:

% /tmp/php-5.2.6/bin/php test.php
xdebug is on
forcing fatal error:

Fatal error: Class 'Abc' not found in /private/tmp/xdebug-destructor-test/test.php on line 13

Call Stack:
    0.0003 52312 1. {main}() /private/tmp/xdebug-destructor-test/test.php:0

__destruct called

==
Xdebug off, no problem:

% /tmp/php-5.2.6/bin/php -d xdebug.default_enable=0 test.php
xdebug is off
forcing fatal error:

Fatal error: Class 'Abc' not found in /private/tmp/xdebug-destructor-test/test.php on line 13
TagsNo tags attached.
Operating SystemOS 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 Version5.2.6
Attached Files

- Relationships

-  Notes
(0000890)
MP_ (reporter)
2008-10-15 15:58

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.
(0000898)
k-fish (reporter)
2008-12-11 21:09

related to 0000391
(0001230)
derick (administrator)
2009-12-29 17:00

Fixed in rev. 3177.

- Issue History
Date Modified Username Field Change
2008-07-18 17:00 sklar New Issue
2008-10-15 15: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


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker