#29756 [NEW]: __destruct called twice with ze1_compatibility_mode = On
| From: | hfuecks at phppatterns dot com | Date: | Thu, 19 Aug 2004 12:17:06 +0000 |
| Subject: | #29756 [NEW]: __destruct called twice with ze1_compatibility_mode = On | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-64928@lists.php.net to get a copy of this message | ||
From: hfuecks at phppatterns dot com
Operating system: Windows 2000
PHP version: 5.0.1
PHP Bug Type: Zend Engine 2 problem
Bug description: __destruct called twice with ze1_compatibility_mode = On
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 bug report at http://bugs.php.net/?id=29756&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29756&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29756&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=29756&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=29756&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=29756&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=29756&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=29756&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=29756&r=support
Expected behavior: http://bugs.php.net/fix.php?id=29756&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=29756&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=29756&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=29756&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29756&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=29756&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=29756&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=29756&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29756&r=float