|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34814 Query in a function for execution on shutdown
Submitted: 2005-10-10 18:38 UTC Modified: 2005-10-10 19:04 UTC
From: egrossi at simplestnet dot com Assigned:
Status: Closed Package: MySQLi related
PHP Version: 5.0.5 OS: Win2k, WinXP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: egrossi at simplestnet dot com
New email:
PHP Version: OS:


 [2005-10-10 18:38 UTC] egrossi at simplestnet dot com
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 ('', '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 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-10 18:44 UTC]
Please try using this CVS snapshot:
For Windows:
 [2005-10-10 19:00 UTC] egrossi at simplestnet dot com
Work well with this CVS snapshot of 2005 oct 10:
 [2005-10-10 19:04 UTC]
Good, that means it's fixed then :)
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Jan 25 07:03:34 2022 UTC