# __destruct() not called

- Thread: https://externals.io/message/7147
- Original archive: https://news-web.php.net/php.internals/7147
- Started by Sebastian Bergmann on 2004-01-17T12:39:59+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #7147 — Sebastian Bergmann — 2004-01-17T12:39:59+00:00

URL: https://externals.io/message/7147#7147

The __destruct() method of the PHPUnit_Extensions_Logger_XML class
  (part of PHPUnit) is not beeing called.

  To reproduce:

    1.) cd pear/PHPUnit

    2.) Create FooTest.php with the following code

          <?php
          require_once 'PHPUnit/Framework/TestCase.php';

          class FooTest extends PHPUnit_Framework_TestCase {
            function testFoo() {
              $this->assertEquals(
                'abcdefghijklmnopqrstuvwxyz',
                'abcdefghilkjmnopqrstuvwxyz'
              );
            }
          }
          ?>

    3.) Execute

          php -d include_path=..;.;/usr/local/lib/php \
          TextUI\TestRunner.php --xml test.xml FooTest

        The result should look like this

          PHPUnit @version@ by Sebastian Bergmann.

          .F

          Time: 0.003502
          There was 1 failure:
          1) testfoo
          expected: <...jkl...> but was: <...lkj...>
          E:\home\php\pear\PHPUnit\FooTest.php:9

          FAILURES!!!
          Tests run: 1, Failures: 1, Errors: 0.

        ("testfoo" should be "TestFoo", but it seems that there is still
        at least one place in the Zend Engine 2 where classnames are
        lower-cased)

  The test.xml file is created (because of the `fopen()` call in the
  __construct() method of PHPUnit_Extensions_Logger_XML), but is empty
  because __destruct() is not called.

  Does anyone have an idea why a __destruct() method would not be called?
  Could this have something to do with exceptions? PHPUnit throws a lot of
  those around ...

  Thanks in advance,
Sebastian

-- 
Sebastian Bergmann
http://sebastian-bergmann.de/                   http://phpOpenTracker.de/

Das Buch zu PHP 5: http://professionelle-softwareentwicklung-mit-php5.de/
