Re: __destruct() not called

From: Date: Sat, 17 Jan 2004 13:47:47 +0000
Subject: Re: __destruct() not called
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-7148@lists.php.net to get a copy of this message
Do you have circular references between 2+ objects? The __destruct() method won't be called then for those, I suppose. Cheers, Michael Sebastian Bergmann wrote:
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


« previous php.internals (#7148) next »