php.net |  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
 [2005-10-10 18:38 UTC] egrossi at simplestnet dot com
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 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-10 18:44 UTC] derick@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.0-win32-latest.zip
 [2005-10-10 19:00 UTC] egrossi at simplestnet dot com
Work well with this CVS snapshot of 2005 oct 10:
http://snaps.php.net/win32/php5.0-win32-latest.zip
 [2005-10-10 19:04 UTC] derick@php.net
Good, that means it's fixed then :)
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed May 22 08:01:26 2019 UTC