From: zeke at cs-cart dot com Operating system: Linux PHP version: 5.2.0 PHP Bug Type: MySQLi related Bug description: MySQLi object destroys too early
Description: ------------ I think its related with http://bugs.php.net/bug.php?id=33772 ======== "Write and Close handlers are called after destructing objects since PHP 5.0.5. Thus destructors can use sessions but session handler can't use objects. In prior versions, they were called in the opposite order. It is possible to call session_write_close() from the destructor to solve this chicken and egg problem." =========== It doesn't work since php 5.2.0. Reproduce code: --------------- <?php function sess_save() { global $db_conn; echo is_object($db_conn) ? "OK" : "FAIL"; } class my_mysqli extends mysqli { public function __destruct(){ sess_save(); } } $db_conn = new my_mysqli($db_host, $db_user, $db_password); ?> Expected result: ---------------- In php 5 prior 5.2.0 displays: "OK" Actual result: -------------- In php 5.2.0 displays: "FAIL" -- Edit bug report at http://bugs.php.net/?id=39491&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39491&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39491&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39491&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39491&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39491&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39491&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39491&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39491&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39491&r=support Expected behavior: http://bugs.php.net/fix.php?id=39491&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39491&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39491&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39491&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39491&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39491&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39491&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39491&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39491&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39491&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39491&r=mysqlcfg
