ID:               29756
 User updated by:  hfuecks at phppatterns dot com
 Reported By:      hfuecks at phppatterns dot com
 Status:           Open
 Bug Type:         Zend Engine 2 problem
 Operating System: Windows 2000
 PHP Version:      5.0.1
 New Comment:

Definately not specific to Windows; checked this out on Linux (Gentoo,
2.4 kernel, PHP 5.0.1) - exactly the same problem.


Previous Comments:
------------------------------------------------------------------------

[2004-08-19 14:16:54] hfuecks at phppatterns dot com

Description:
------------
Using unmodified copy on php.ini-recommended (no extensions loaded
etc.). Able to reproduce this problem with the Apache SAPI, CLI and CGI
SAPIs.

With zend.ze1_compatibility_mode = On class destructors get called
twice, once directly after the constructor.

With zend.ze1_compatibility_mode = Off (no other modifications to
runtime) problem disappears (destructor called correctly).

This seems to have been reported before (not enough info):
http://bugs.php.net/bug.php?id=27698

Have yet to confirm whether this in Windows specific (more from Linux
when I get there...)

Reproduce code:
---------------
<?php
class Test {
        function __construct() {
                echo __METHOD__."\n";
        }

        function someMethod() {
                echo __METHOD__."\n";
        }

        function __destruct() {
                echo __METHOD__."\n";
                var_dump(debug_backtrace());
        }
}

$T = new Test();
$T->someMethod();
?>

Expected result:
----------------
Test::__construct
Test::someMethod
Test::__destruct
array(1) {
  [0]=>
  array(4) {
    ["function"]=>
    string(10) "__destruct"
    ["class"]=>
    string(4) "Test"
    ["type"]=>
    string(2) "::"
    ["args"]=>
    array(0) {
    }
  }
}

Actual result:
--------------
Test::__construct
Test::__destruct
array(2) {
  [0]=>
  array(5) {
    ["file"]=>
    string(20) "D:\php\test\test.php"
    ["line"]=>
    int(18)
    ["function"]=>
    string(10) "__destruct"
    ["class"]=>
    string(4) "Test"
    ["type"]=>
    string(2) "::"
  }
  [1]=>
  array(3) {
    ["file"]=>
    string(20) "D:\php\test\test.php"
    ["line"]=>
    int(18)
    ["function"]=>
    string(7) "unknown"
  }
}
Test::someMethod
Test::__destruct
array(1) {
  [0]=>
  array(4) {
    ["function"]=>
    NULL
    ["class"]=>
    string(4) "Test"
    ["type"]=>
    string(2) "::"
    ["args"]=>
    array(0) {
    }
  }
}


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=29756&edit=1

Reply via email to