From: freddie at bingham dot net Operating system: Windows XP PHP version: 5.1.0RC1 PHP Bug Type: MySQLi related Bug description: Access to MySQLi object lost in shutdown function
Description: ------------ This bug (http://bugs.php.net/bug.php?id=33635) reports the same php error but involves session handlers. This bug (http://bugs.php.net/bug.php?id=33772) describes a possible reason this problem to be working as designed. As reported bu the php team: "This is chicken/egg problem and it cannot be solved. One expect that destructors are called before session close the other uses object for save handlers." Are we to assume that a change has been made that is calling destructors before session close? Fine, but why is this affecting register_shutdown? If register_shutdown() is part of the request, we expect to have access to the same scope. Secondly why is this just affecting MySQLi? Go ahead and reproduce the example code using MySQL and you'll see that it works as expected. Reproduce code: --------------- function shutdown() { global $link; echo mysqli_real_escape_string($link, 'foo'); } $servername = 'localhost'; $username = 'username'; $password = 'password'; $link = mysqli_init(); mysqli_real_connect($link, $servername, $username, $password); echo mysqli_real_escape_string($link, 'foo') . '<br />'; register_shutdown_function('shutdown'); Expected result: ---------------- foo foo Actual result: -------------- foo Warning: Couldn't fetch mysqli in c:\program files\apache group\Apache\htdocs\foo.php on line 7 -- Edit bug report at http://bugs.php.net/?id=34377&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34377&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34377&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34377&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34377&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34377&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34377&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34377&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34377&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34377&r=support Expected behavior: http://bugs.php.net/fix.php?id=34377&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34377&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34377&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34377&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34377&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34377&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34377&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34377&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34377&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34377&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34377&r=mysqlcfg
