From: egrossi at simplestnet dot com
Operating system: Win2k, WinXP
PHP version: 5.0.5
PHP Bug Type: MySQLi related
Bug description: Query in a function for execution on shutdown
Description:
------------
SQL Query like INSERT, inside a function called by
register_shutdown_function() doesn't work on PHP 5.0.5 but work perferctly
in PHP 5.0.4 and before or with MySQL extension.
Note: the MySQL link identifier is created and passed in arguments of
shutdown function.
Reproduce code:
---------------
function cb_shutdown( $lk ) {
mysqli_query($lk, "INSERT INTO `log`
(`ip`, `data`)
VALUES ('127.0.0.1', 'test')");
}
$link = mysqli_connect( "localhost", $db_user, $db_pass, $db_name);
register_shutdown_function("cb_shutdown", $link);
Expected result:
----------------
A new record in `log` table.
Actual result:
--------------
No record added and warning:
Couldn't fetch mysqli
--
Edit bug report at http://bugs.php.net/?id=34814&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34814&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34814&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34814&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34814&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34814&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34814&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34814&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34814&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34814&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34814&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34814&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34814&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34814&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34814&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34814&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34814&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34814&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34814&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34814&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34814&r=mysqlcfg